The Action class is the bridge between user requests and business logic. Each Action acts as a business agent for the customer. When the RequestProcessor class preprocesses a request, after creating an instance of Action, it calls its own processActionPerform() method, which calls execute() of the Action class.
Complete action
<action path="/aFullAction" type="somePackage.someActionClass"> name="someForm" input="someJSP.jsp" <forward name="successful" path="someJSP.jsp"/> <forward name="failed" path="someOtherJSP.jsp"/> </action>
First, the ActionServlet of Struts receives a request, and then based on the configuration of struts-config.xml Locate the corresponding mapping;
Next, if the scope of the form is request or it is difficult to find the form in the defined scope, create a new form instance;
Get the form After the instance, call its reset () method, and then put the parameters in the form into the form. If the validate attribute is not false, call the validate() method;
If validate() returns non-empty ActionErrors, It will be transferred to the URI specified by the input attribute. If empty ActionErrors is returned, then the execute() method of the Action is executed and the target URI is determined based on the returned ActionForward.
The effect of this is: execute() will only be executed after validate() succeeds; the input attribute specifies a URI.
The above is the detailed content of What does action mean in jsp. For more information, please follow other related articles on the PHP Chinese website!