1, a reference to the configuration file
There can be more than one configuration file in struts, and a struts profile can be set up in each module's package.
The main configuration file, placed in the "src" folder, can introduce other profiles, introduced in the way:
<!--in the general profile, introduce additional configuration files--><include file= "Gy/actions/struts.xml" ></include>
Where the configuration path of the file property can be right-click, copy qualified name
2, configuration of common constants
Specify the request encoding format
Specifies the URL suffix name of the access
<!-- This property specifies the request suffix that needs to be processed by Struts 2, the default value of which is action, which means that all requests that match *.action are handled by STRUTS2. if the user needs to specify multiple request suffixes, the multiple suffixes are separated by commas (,). default access suffix for struts: in struts1, the default access suffix is *.do in Struts2, and the default access suffix is *.action such as: http://localhost:8080/ Usestruts/take/a/user_login.action?username=xxxxdedd (found) if the value "Action" : The logo can only be used when accessing the URL. Action suffix, can not write suffix, can not be some other suffix "action,do": The mark can only be action or do suffix, other not, do not write "Action,do,": Do or action or do not write all --<constant name= "struts.action.extension" value= "do,action,"/>
Some other
<!--This property specifies the maximum number of bytes allowed for the entire requested content on a Struts 2 file-- <constant name= "struts.multipart.maxSize" value= "2097152"/ > <!--After modifying the Struts profile, the system reloads the file automatically, defaults to False, is used in production, and the development phase is best opened-- <constant name= " Struts.configuration.xml.reload "value=" true "></constant> <!--Allow dynamic method calls-- <constant Name= "Struts.enable.DynamicMethodInvocation" value= "true" ></constant>
3, package configuration
<!--because the general configuration file introduced the configuration file, so here only need to configure the package can be, name casually write, can not repeat namespace, namespace, in the URL link of access, the intermediate URL must contain, can have superfluous. With regard to namespace, struts will first find the last "/" from the URL, then the last/trailing path after the last/and previous port of the path is the string of the namespace and then compared to the namespace. Extends, inherit struts-default--><package name= "user" namespece= "/A" extends= "Struts-default" >
4,action Configuration
<!--access class in Name:url: The corresponding class name, with package name method: The name of the methods executed
--><action name= "Login" class= "actions. Loginaction "method=" Login > <!--name:login method returns the corresponding string, which can be success,--<result name= "Success" >/inde X.jsp</result></action>
(a) Use of the Java Web struts2 framework-struts configuration file