The working principle of actionform

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.