struts2--configuration (general, constant, page configuration)

Configuration of struts2:
package: The configuration of package is used to distinguish different actions.
Attributes inside the package:
name: distinguish between different packages, any value, multiple packages can be written in the struts.xml file but the name value cannot be the same;
extends: whether the current action supports the function of struts, generally inherits struts-default ;
namespace: namespace, the value of the name attribute in the action tag together constitute the access path.
Namespace maximized: [/], [/aa] The most matching one is executed first, and [/] is executed last.

Configuration of struts2-action: The configuration of the
action is written in the package; multiple actions can be configured in a package;
the attribute of the action; name: and the name attribute in the package together form the access path
     class: the package class path of the action
     method: the configuration execution The method in the action, the execute method is executed by default without configuration.
Inside the action tag there is the result tag: it configures the view based on the return value.
Attributes of result:
name: same as the return value configuration in action
type: way to path (forwarding, redirection...)
Default action and action's default processing class:
default action refers to when the filter cannot find the specified When the action is executed, a default action is executed by default. <default-action-ref name="default">
The default processing class of action means that if the class is not specified when configuring the action, it will go back to the ActionSupport class in struts2 by default to execute the execute method and return success.

 

struts2 constant configuration:
The default.properties (key-value mode) in the struts2-core-2.3.15.3.jar package contains the configuration of all constants.
Three ways:
1. Write a struts.properties file format key-value under src;
2. Configure in struts.xml: <constant name="constant name" value="constant value">[ The most commonly used in development ] <constant name=" struts.i18n.encoding
" value="UTF-8">
Specify the default encoding set, set the form post submission Chinese garbled
<constant name="struts.action.extension" value="action">
Specify The suffix of action
<constant name="struts.configuration.xml.reload" value="true">
specifies the loading method of the configuration file. If it is set to true, it can be automatically loaded after modification.
<constant name="struts.devMode" value="true">
Used in development mode, which can print more detailed error information
<constant name="" value="">



 <param-name></param-name>
 <param-value></param-value>
</initparam>

Struts--> include (introduce tags, introduce external configuration files) :
Development is usually multi-person development, that is, multi-person changes struts.xml. Then you can use multiple different configuration files similar to struts.xml for configuration, and then introduce them into struts.xml.
<include:file="baoming.xxx.xml"></include>

 

The configuration of the result page of struts2: the configuration
of the result tag in the action tag.
<action>
 <result name="" type=""></result>
<action>
attributes:
name: Configure to different paths according to the return value of the action class.
type: four types:
dispatcher: forwarding the page, which is the default value
redirect: redirecting the page
chain: forwarding to action
redirectAction: redirecting to another action.

Global page configuration: write <global-results>  <result name="" type=""></result> </global-results> local page configuration inside
the <package> tag : both global pages are configured in the package Partial pages are also configured, and the final page configuration shall prevail.




Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326522637&siteId=291194637