The controller component includes an ActionServlet class and an Action class. The ActionServlet class is coming from the Struts frame, which is the control hub of the entire Struts framework, usually does not need to be expanded. The STRUTS framework provides an Action class for extended to handle specific HTTP requests.
When the user submits an HTML form, the Struts framework automatically assembles the form data into the Actionform Bean. The properties in the ActionForm bean are in one or one in the field in the HTML form. The next Struts framework automatically invokes the Validate () method of the Actionform Bean for forms. If the Validate () method returned to the ActionerRors object as null, or does not contain any actionMessage objects, it means no errors, data verification is passed. If the actionMessage object is included in the ActionerRORS, you represent an authentication error, and the Struts framework saves the ActionerRors object to the REQUEST range, then forward the request to the appropriate view component, and the view component via
ActionMapping: Contains this Action configuration information, and corresponds to the
ActionForm: The user's form data is included. When the Struts framework calls the execute () method, the data in the ActionForm has passed form validation.
HTTPSERVLETREQUEST: Current HTTP Request Object
HTTPSERVLETRESPONSE: Current HTTP Response Object
The Execute () method of the Action class returns an ActionForWard object that contains request forwarding path information.
When the HelloAction class calls HTTPSERVLETREQUEST's SetAttribute () method, when you pass the Personbean object to Hello.jsp, you need to provide a property named "Personbean" key: Request.SetAttribute ("Personbean", PB);
Hello.jsp reads the Personbean object by this property key named "Personbean":
Hello
h2>
logic: present>
TYPE = "Hello.HelloAction" // Specify the full class name of the action Name = "Helloform" // Specify an actionform bean that needs to be passed to Action Scope = "request" // Specify the range of the ActionForm Bean Validate = "true" // Specify whether to execute a form verification INPUT = "/Hello.jsp"> // Specify forwarding path when the table verification fails action> The