One. The composition of the view component:
HTML Document JSP Customized Tag JavaScript and Stylesheet Multimedia File Message Resource (Resource Bundle) Actionform Bean
two. DTO data transfer object
The benefits of transmitting data using DTO:
Reduce the redundancy of transfer data and improve transmission efficiency.
It helps to achieve independence between individual layers.
three. DTO: ACTIONFORM Bean provided by Struts framework
Used to pass HTML form data between view layers and control layers.
four. Actionform lifecycle:
1. Create an actionform: You can override the validate () and reset () method
The abstraction of the ActionForm class is defined in the Struts framework, and it must be created in the application to capture the specific HTML form data. For reset () methods,
The ActionForm within the Session range is extremely useful because the same ActionForm instance is shared by multiple requests.
Verify that it can be configured as needed by Struts's Validator framework. (The current program is all XML configuration)
2. Access ActionForm
a. Use the struts HTML tag library
(In addition to Form using Struts label, other things I think is also convenient to use HTML.
However, the Java code on the page may be more, see the project needs, if you use the label
Feeling or learning JSTL is better, Struts is relatively dead, versatility is also poor, or you can write it yourself)
b. Remove the Actionform instance from the request or session range
c. Access Actionform directly in the Execute () method of the Action class
3. Processing forms cross-page
a. Define
b. Define the Page property in ActionForm, and the hidden field of the form Page Page
c. In the ActionForm's reset () method, you can only recover the current form of properties to the default. You can call Request.GetParameter ("Page")
Method to read the current page number
d. In an actionform's validate () method, you can only verify the attributes associated with the current form. At this point, the PAGE attribute represents the current page number.
e. When configuring the ActionForm and Action mapping, you should set the ActionForm range to session.