# In the namespace configuration variable of Struts2 notes

Source: Internet
Author: User

This article will introduce the numbering in the namespace configuration variables of Struts2, and hope it will be helpful to you.


What is the significance of the namespace of the Struts2 note package?

Struts. xml configuration file of struts2

There is a label in it:
<Package>
This tag has an attribute namespace.

This attribute is used to process the case where the same Web application contains an Action with the same name. Strtuts2 manages actions in a namespace.
In this way, we can avoid the need for an action with the same name sometimes, but the service processing needs are different. Therefore, we can use namespace to achieve this effect. In this way, even if there is an action with the same name but the package name is different, the actions that finally accept business processing are different. It is similar to the first class of the third class (1) and the first class of the third class (2), although the two students have the same seat number. However, we can still identify specific students with different class names. This is probably the case.
This is the same as package in java.

 
Note: If the specified namespace attribute is not configured for <package/>, all actions under the package are in the default package space.

Configuration variables of Struts2 notes

 

Struts. enable. SlashesInActionNames
If the name attribute of action needs to contain a slash/, set this variable to true.

Struts. enable. DynamicMethodInvocation
When this configuration variable is set to true, the dynamic action method is supported. Allows an action to configure multiple business requests.
 

An error occurs because the action name contains vertices or hyphens.

Although the Action name can be very flexible, If you assign a value with a dot (.) or hyphen (-) to the name attribute

For example, my. user or my-action may cause unknown exceptions. Therefore, it is not recommended to use dot (.) and hyphen (-) in the name attribute value of Action (-).

Excerpt from: Lightweight J2EE Enterprise Application Practice P186

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.