Detailed description of result parameters in struts2 action

Source: Internet
Author: User
Tags xslt

Detailed description of result parameters in struts2 action
Chain

Used to process the action chain

Com. opensymphony. xwork2.actionchainresult

Dispatcher

It is used to redirect to a page.

Org. Apache. struts2.dispatcher. servletdispatcherresult

Freemaker

Process freemarker templates

Org. Apache. struts2.views. freemarker. freemarkerresult

Httpheader

Result type that controls special HTTP Behaviors

Org. Apache. struts2.dispatcher. httpheaderresult

Redirect

Redirect to a URL

Org. Apache. struts2.dispatcher. servletredirectresult

Redirectaction

Redirect to an action

Org. Apache. struts2.dispatcher. servletactionredirectresult

Stream

Sends an inputsream object to a browser, which is usually used to process file downloads and return Ajax data.

Org. Apache. struts2.dispatcher. streamresult

Velocity

Process the velocity Template

Org. Apache. struts2.dispatcher. velocityresult

XSLT

Process XML/XLST templates

Org. Apache. struts2.views. XSLT. extends tresult

Plaintext

Displays the content of the original file, such as the source code of the file.

Org. Apache. struts2.dispatcher. plaintextresult

Redirect-action

Redirect to an action

Org. Apache. struts2.dispatcher. servletactionredirectresult

Plaintext

Displays the content of the original file, such as the source code of the file.

Org. Apache. struts2.dispatcher. plaintextresult

Briefly describe the name and type attributes of result:
Success: the action is correctly executed and the corresponding view is returned. Success is the default value of the name attribute;
None: indicates that the action is correctly executed, but no view is returned;
Error: Action execution failed. The error processing view is returned;
Input: to execute an action, you need to obtain the parameters from the front-end interface. Input indicates the interface of this parameter input. Generally, these parameters are verified in the application. If the verification fails, will be automatically returned to this view;
Login: action is not correctly executed because the user has not logged in. the login view is returned and the user is required to perform login verification.
Dispatcher: Request forwarding. The requestdispatcher's forward () or include () method is called at the underlying layer. dispatcher is the default value of the type attribute and is usually used to redirect to a JSP. localtion specifies the location of the JSP, if parse is false, the location value is not parsed as ognl. The default value is true;
Redirect: redirection. The data in the action cannot be displayed on the new page. Because the response. sendredirect ("") method is called at the underlying layer, data within the request range cannot be shared. The parameter and dispatcher are used in the same way;
Redirect-Action: redirects to another action. The parameter is used in the same way as the chain parameter. You can specify a new name for the attribute in the original action to be added to the new action, you can add <Param name = "B" >$ {A} </param> to the result tag, which indicates that the value of variable A in the original action is transferred to B, the next action can be operated using B in the value stack. Note that if the value is Chinese, some encoding is required, because Tomcat does not support direct URL transfer of Chinese characters by default!
Velocity: uses the velocity template to output results. Location specifies the template location (*. VM). If parse is set to false, location is not parsed by ognl. The default value is true;
XSLT: Use XSLT to convert the result to XML output. Location specifies *. the location of the XSLT file. If parse is false, location is not parsed by ognl. The default value is true. matchingpattern specifies the desired element mode and excludepattern specifies the rejected element mode. Regular Expressions are supported, all elements are accepted by default;
Httpheader: return a custom httpheader based on the value stack. Status specifies the response status (that is, response. senderror (int I) is redirected to the status page of the server such as 500). If parse is false, the header value will not be parsed by ognl, headers, and added to the header value, for example: <Param name = "headers. A "> helloworld </param>. You can add multiple key-values to form a hashmap;
Freemaker: uses the freemaker template engine to present a view. Location specifies the template (*. FTL) location. If parse is false, the location value will not be parsed by ognl. The contenttype specifies the medium type for parsing. The default value is text/html;
Chain: forward an action request with the original status to the new action. The two actions share an actioncontext. The actionname specifies the name of the new action to be switched, and the method specifies the method to be switched, namespace specifies the namespace of the new action. If this parameter is left blank, it indicates that the action is in the same namespace as the original action. skipactions indicates a set composed of the names of the connected actions, this type of results is generally not recommended;
Stream: sends raw data directly to the response. It is usually used for downloading. contenttype specifies the stream type. The default value is text/plain. contentlength calculates the stream length in bytes, contentdisposition specifies the file location, usually filename = "file location". Input specifies the name of inputstream. For example, imagestream and buffersize specify the buffer size. The default value is 1024 bytes;
Plaintext: displays JSP or HTML in the original text. Location specifies the file location, charset specifies the character set;

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.