(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