Namespace configured for structs2

Source: Internet
Author: User
1 Namespace determines the action access path. The default value is "", which can receive actions in all paths.2 Namespace can be written as/,/XXX, or/XXX/yyy. The access path of the corresponding action is/index. Action,3 /XXX/index. Action, or/XXX/YYY/index. Action.4Namespace should also be named by modules.

 

 1   <?  XML version = "1.0" encoding = "UTF-8"  ?>  2   <!  Doctype struts public  3  "-// Apache Software Foundation // DTD struts configuration 2.0 // en"  4   Http://struts.apache.org/dtds/struts-2.0.dtd"  >  5   6   <  Struts  >  7       <  Constant  Name  = "Struts. devmode"  Value = "True"   />  8   9       <! --  In the package below, the namespace is/front. To access the index, enter./Front/index in the browser.  -->  10       <  Package  Name  = "Front"  Extends  = "Struts-Default"  Namespace  = "/Front" >  11           <  Action  Name  = "Index"  >  12               <  Result  > /Namespace. jsp </  Result  >  13           </  Action >  14       </  Package  >  15       <! --  In the package below, the namespace is empty. Access the index and enter the index in the browser. No matter whether there are other addresses in front, this is about the search order.  -->  16        <  Package  Name  = "Main"  Extends  = "Struts-Default" Namespace  = ""  >  17           <  Action  Name  = "Index"  >  18               <  Result  > /Namespace. jsp </  Result  >  19              <! --  If the attribute is not written, the default value is success.  -->  20           </  Action  >  21       </  Package  >  22   23   </  Struts  > 

 

1. Obtain the URI of the Request Path. For example, the URL is http: // server/struts2/path1/path2/path3/test. Action.

2. first, find the package whose namespace is/path1/path2/path3. If this package exists, search for the action named test in this package. If this package does not exist, go to step 3;

3. Find the package whose namespace is/path1/path2. If this package exists, search for the action named test in this package. If this package does not exist, go to step 4;

4. Find the package whose namespace is/path1. If the package exists, search for the action named test in the package. If the package still does not exist, step 5

5. Go to the default namaspace, that is, find the action named test under the package with an empty namespace. If the action still cannot be found, the page prompts that the action cannot be found.

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.