Use namespace in struts2

Source: Internet
Author: User

NamespaceGenerally, it is better to use it when the project is complex.

In struts2 projects, namespace is usually used in the following environments:

1.In the configuration file (struts. XML) and the XX. xml file it contains

Generally, namespace is used to search for actions.

For result, the returned results are generally written as absolute paths.

At this time, if the returned result is an action and the action is not in the same namespace, we also need to write the absolute path. At this time, different namespaces and directories use the same.

2.In the connection request, for example: <a href ="Xxx/test1/Test2/a. Action"> </A>

The program will automatically query xxx/test1/Test2/for any action with a value. If yes, the program will execute it. If no action is found, search for any action in xxx/test1/and execute the action if it finds it. Follow this rule, but this rule cannot be reversed. If not, in the namespace ="/"If no action is found, an error is returned.

3.In the struts tag <s: Form>. The usage is the same as that in 2.

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.