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>