Step 1:
The visible range of objects: request, session, application, and page.
Request: valid within a request cycle. It starts when you click a button on the page and ends when the server returns the response page (including the response page ).
Session: valid throughout the process of establishing a connection between a user and the server.
Application: the entire web application Program .
Page: valid only for one JSP page.
Step 2:
Actionform is unique within the validity period (visible range) You have determined.
Step 3:
Call its reset method before assigning values to actionform each time. The function is to restore the value in actionform to the initial state. In the application, we can assign an initial value to the variable in the reset so that an object on the page has a display value.
Step 4:
The combination of the visible range and the initialization before the value assignment.
Because of the features described in step 2, if the visible range is request, the reset method is not very important, because each call generates a new actionform instance, therefore, the actionform you operate will not be shared with others, but will not be affected by others. If the visible range is session, because the actionform is unique within the range of sessions, therefore, all the places where you need to use this actionform within the session scope call the same actionform, if you do not assign an initial value to the variable in the reset, the value assigned to the actionform that was previously called will be valid for this call, which is nothing at all. However, if you just need to assign values to some variables in the actionform when you call it again, the remaining variables will remain the value obtained last time, so that you get a "new and old mixture ", I think most of this is not what you expected. If the visible range is application, the impact will be even more difficult to understand. In this case, you will not only influence yourself, the operations of other users who use the application will also affect you.
Step 5:
Knowing the role of the reset method and the unique feature of actionform in the scope provides a foundation for us to flexibly process actionform behavior. For example, if you need to collect data across multiple pages, you can set scope to session, the reset method is not implemented-in this way, the previously collected data will not be cleared when put data is put on each page, finally, after you collect the data, call the custom Initialization Method in actionform in action, such as resetfield.
I can't think of the specific features, but I still need to know more about these features during the application so that we can maximize the power of the architecture.