struts2_ struts. Explanation of XML configuration file

1.bean

Bean detailed explanation: https://www.cnblogs.com/lulu638/p/4340703.html

2.constant

Constant attribute configuration. For configurable attributes, refer to default Properties (in struts2-core-2.3.24.jar package / org / Apache / Struts2 / default. Properties)

3.include

  struts. The XML file uses the include tag to contain the contents of other XML files, which is suitable for team cooperation. Each person does his own part, and finally in struts Use the include tag in the XML file to include other people's configuration files

4.package

Struts 2 uses packages to organize actions, defines actions under packages, configures a package through package elements, and defines an action through package sub element actions;

The core components in the struts 2 framework are actions and interceptors. Struts 2 uses packages to manage actions and interceptors. Each package is a collection of multiple actions and interceptor references.

Name attribute: a package must specify a name value as the unique identifier that references the package

Extensions: optional attribute. It specifies that a child package can inherit the action and interceptor configurations of one or more parent packages, and specifies that a package inherits all configurations of another package. In general, we use struts default as the basis of the package., Generally, the default file that inherits struts by default is struts - defaule XML configuration file, separated by "," when inheriting multiple parent packages   

Namespace: optional attribute, the unique namespace of actions, defines the namespace with package, the default is' ', and the namespace is / actionname during processing

Abstract: optional attribute that specifies whether the package is an abstract package and defines the package as abstract. If marked true, the package cannot be used by the end user.

Action element:

Name attribute: a required attribute, which is used to configure the URL of the action

Class attribute: optional. If yes, configure the full class name of the action implementation class. If not, the struts framework will automatically match the action implementation class according to the name attribute

Method attribute: used to specify which method of the action implementation class to call. If this attribute is not configured, it defaults to the execute method of the action implementation class

Convert attribute: a non mandatory attribute, which is the full class name of the type conversion applied to the action

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>