Struts2 lab error notes

Source: Internet
Author: User

(1) The name attribute of the result in the Struts. xml configuration file must match the string returned by the function in the business logic processing class (action class ).

(2) After modifying struts. xml and action classes, you need to re-update the web project (Redeploy) on the server)

(3) it is best to store JSP pages corresponding to the same business logic in folders. Otherwise, the JSP files may be complicated.

(4) One action processes multiple business logic

Code:

<Action name = "loginaction _ *" class = "com. loginaction" method = "{1}">
<Result name = "success">/success. jsp </result>
<Result name = "error">/error. jsp </result>
<Result name = "register_error">/register_error.jsp </result>
<Result name = "register_sucess">/register_sucess.jsp </result>
</Action>

The code above indicates that when the Form request is loginaction_login.action, the login method is called and the request is loginaction_register.action, the register method is called.

Struts2 lab error notes

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.