Just learned the working principle of actionform, in order to want a better understanding, want to sort out, also convenient for everyone to reference, there are steps:
(1) Check the action mapping to determine if the Actionform mapping has been configured in the action.
<form-beans>
<form-bean name="loginForm" type="#"></form-bean>
</form-beans>
<!--两个name同名才行-->
<action-mappings>
<action path="#" type="#" name="loginForm" scope="request" validate="false">
<forward name="#" path="#"></forward>
</action>
</action-mappings>
(2) Look for Form-bean configuration information according to name.
(3) Check the use of the action's form bean to determine if the form bean instance is already in this range (request, session).
(4) If the current scope is in love there is already an instance of the form bean, which is reused for the current request, if it is the same type.
(5) Otherwise rebuild a form bean instance and call the constructor method to keep it in a certain range.
(6) The Reset () method of the form Bean is invoked
(7) Call the corresponding setter method and assign value to the State property
(8) If the Validatede property is set to True, then the Validatede () method of the form Bean is called (server checksum)
(9) if Validatede () does not return any bugs, the controller passes actionform as a parameter to the Execute () method of the action instance and executes
The work flow chart is as follows:
Note: Reset (), for property reset, control to the bean before assigning value.
Note: Call Order: Constructor method->reset ()->setter () is invoked first, and if the page is refreshed, the constructor and reset methods are called