Standard result code in the result of Struts2

Source: Internet
Author: User

a result represents a possible output. When the method execution of the action class completes, it returns a string type of routing string, which the framework chooses the corresponding result code to output to the user.
A standard set of result codes is defined in the Com.opensymphony.xwork2.Action interface for developers to use, of course Only our action inherits the Actionsupport class to use the following result code , as follows:
public interface Action
{
Publicstatic final String SUCCESS = "SUCCESS";
Publicstatic final String none = "None";
Publicstatic Final String error = "Error";
Publicstatic final String input = "INPUT";
Publicstatic Final String login = "Login";
}
In the course of operation, if you findAddfielderror ()in ainformation orthe type conversion failed orinput checksum failure , etc.
Then it will automatically jump to the name of input <result/>, and then go to the corresponding page of input
If the form in the JSP page is written in normal <form> , the original data disappears when an error occurs and the page is returned
If the form is written in <s:form/> on a JSP page, and the page is returned with an error, the original data still exists
If you do not provide a <result/> with the name value of input, then an error will prompt 404 error in the browser directly
In addition to these predefined result codes, developers can define additional result codes to meet the needs of their own applications
To.

Standard result code in the result of Struts2

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.