Explain in detail how to configure the default action in struts 2

1、 JSP default settings

1. When the accessed action does not exist, the page will display an error message. You can configure the default action to handle the user's abnormal operation;

2。 Configuration method:

In struts In the XML file, add the following:

Where index is the name attribute value of the default action;

3. After configuring the default action, if there is no action to access in the corresponding namespace, it will automatically jump to the default action for processing.

4. Instance

web. xml:

struts. xml:

index. jsp:

2、 Action default forwarding

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>