Struts2 configuration file namespace

Source: Internet
Author: User

The previous article briefly introduced Web. xml configuration.

Now let's take a look at the struts configuration.

First, copy a struts. xml file.

Before looking at the configuration, analyze the process of processing client requests on the server.

First, Tomcat receives the request and analyzes which webapplication is used.

Then go to the application to check the configuration. A filter is provided. From filter mapping, let's take a look at the filters to filter the IP addresses.

The filtered P addresses will be received and processed by the filter.

If the filter is struts2. The filter will view the namespace of the URL request.

Find the corresponding action

Display the corresponding JSP according to the action result

Processed by struts.

 

1> first of all, it is worth noting that if we want to make any changes to the configuration file during development, it will immediately take effect, rather than re-configuring the startup. So we need to use the configuration.

<Constant name = "struts. devmode" value = "true"/>

 

 

The namespace of the package can be empty, which indicates that actions in all paths can be processed. Namespace is blank. The default value is namespace = ""

The namespace should also be named by the module.

 

Generally, you must configure your own class in the action. If not configured, use the default class: actionsupport ..

<Result name = ""> if the name is not configured, the default value is success.

In the development of ER, the defined action is indeed inherited from actionsupport.

 

Note that struts2 processes the action as a new action object for each access.

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.