Struts Convention Plugin process (2.1.6 +), convention2.1.6

Source: Internet
Author: User

Struts Convention Plugin process (2.1.6 +), convention2.1.6

First add lib:

<dependency>          <groupId>org.apache.struts</groupId>          <artifactId>struts2-config-browser-plugin</artifactId>          <version>2.3.20</version>      </dependency>      <dependency>          <groupId>org.apache.struts</groupId>          <artifactId>struts2-convention-plugin</artifactId>          <version>2.3.20</version>      </dependency>

Access http: // localhost: 8080/conv/config-browser/a. action to view all the currently mapped paths

 

The plugin is executed in the following order:

1. Find the following packages:struts,struts2,action,actions

All the above packages found in depth are automatically used as the root directory

2. Then find the following classes in the package:com.opensymphony.xwork2.ActionOr it inherits com. opensymphony. xwork2.ActionSupport, or the class name ends with Action.

3. ing to url:

Com. example.Actions. MainAction->/maincom. example.Actions. Products. Display->/products/displaycom. example.Struts. Company. details. ShowCompanyDetailsAction->/company/details/show-company-details (all in lower case)

 

For example, you can skip some packages:struts.convention.exclude.packages= Org. apache. struts. *, org. apache. struts2. *, org. springframework. web. struts. *, org. springframework. web. struts2. *, org. hibernate. * (skipped packages cannot be added, even if manually added)

Package name automatically searched:struts.convention.package.locators= Action, actions, struts, struts2

The name of the automatically searched package starts with struts. convention. package. locators. basePackage =

End of the automatically searched Class Name: struts. convention. action. suffix = Action

Manually specify a specific package: struts. convention. action. packages =

 

4. By default, all results are found here:WEB-INF/content

For example, public class MyJsp extends ActionSupport {public String execute () {return"Here";}}

Public class HimJsp extends ActionSupport {@ Action ("My-jsp-here") // Implement chain by specifying it as a specific path, provided that there is no public String execute () {return"Yes";}}

 

 

 

 

 

It will eventually become,

 

You can set Automatic Reload:

<constant name="struts.devMode" value="true"/>

<constant name="struts.convention.classes.reload" value="true" />

 

Struts. convention. action. alwaysMapExecute = false disable automatic invocation of execute ()

Struts. convention. action. disableScanning = true disable Scanning

Struts. convention. action. mapAllMatches = true no @ Action is automatically mapped

Struts. convention. action. name. lowercase = false do not change to lower case

Struts. convention. action. name. separator = _ name separator

Struts. convention. action. eagerLoading = true can improve performance when Spring is not used.

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.