Strus2 configuration global result cannot find the corresponding action from the user URL

Source: Internet
Author: User

When the action cannot be found from the user's URL, we want a default friendly interface to return to the user. The following describes the configuration in struts.

 

 

For applications that use the struts2 framework, do not directly link hyperlinks to a view resource. This method adds additional risks. We recommend that you send all requests to the struts2 framework to process user requests, even if they are just simple hyperlinks. For simple hyperlink requests, you can use the action (which should be placed at the end) defined.

Struts2 also allows defining a default action in the container. When the URL requested by the user cannot find the corresponding action in the container, the system uses the default action to process the user request.

The default action is configured through the <default-action-ref.../> element. A default action is configured for each <default-action-ref.../> element.

Example:

<Package name = "default_struts" extends = "struts-Default">

<! -- Configure a default action. The default action is simpleviewresultaction. -->

<Default-action-ref name = "welcomeaction"/>
<! -- Name is required and points to another valid action in the container. This action will be the default action in the container. -->

 

<! -- Configure the default action through the Action Element -->

<Action name = "welcomeaction" class = "MSS. iorder. server. Action. welcomeaction">
<Result>
/Login. jsp
</Result>
</Action>
</Package>

 

 

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.