<!--
  
1. struts.xml Configuration constants , To cover struts.properties Default constant configuration in
In general , This configuration is placed in the struts.xml in , Don't put it in the xml in .
constant Elements and package It's the same level
<struts>
<constant name="" value=""></constant>
</struts> 2. modular xml Profile import
```
<struts>
<include file=" Of each module xml The configuration file "></include>
</struts>
``` 3. Common constants
1) Development mode : modify struts.xml after , Don't have to restart Tomcat.
devMode Patterns are development patterns , Turn it on by default i18n.reload、configuration.xml.reload.
<constant name="struts.devMode" value="true" />
2) Set when struts After the profile of is modified , Does the system automatically reload the file : The default value is false( Use in production environment ), It is better to open the development stage
<constant name="struts.configuration.xml.reload" value="true"/>
3) Specifies that each request arrives , Reload resource file
<constant name="struts.i18n.reload" value="true"/>
4) Appoint XSLT Result Use style sheet caching
<constant name="struts.xslt.nocache" value="true"/>
5) Set up actionName The suffix : The default value is action, All matches *.action All requests are made by Struts2 Handle .
If the user needs to specify multiple request suffixes , Comma between suffixes (,) separate
<constant name="struts.action.extension" value="action,,"/>
6) Default view theme
<constant name="struts.ui.theme" value="simple" />
7) Set whether the browser caches static content : The default value is true( Use in production environment ), It is better to close the development phase
true: Indicates that there is a cache , false: There is no cache
<constant name="struts.serve.static.browserCache" value="false"/>
8) Set whether dynamic method calls are supported
<constant name="struts.enable.DynamicMethodInvocation" value="false"/>
9) Specify default encoding set , Act on HttpServletRequest Of setCharacterEncoding Method and freemarker 、velocity Output
<constant name="struts.i18n.encoding" value="UTF-8"/>
8)... 4. The elements
1)package: yes struts.xml Root element (strtus) Child elements . Used to manage multiple action Elements .
* The format is :
<package name="" extends="" namespace="" abstract="true/false">
* usage : One module is divided into one <package> Elements .
* Common properties :
- name: At present <package> Name of element , Multiple <package> Elemental name Cannot be the same .
- extends: Self defined <package> Element must inherit from package struts-default Or its sub package .
- namespace: Namespace , and actionName Together, they decided on a action Access path of , Similar to the role of a namespace in a program .
- abstract: At present <package> Whether the element is abstract .
If true, Then the current <package> You can't define action Elements , Can only be used by other <package> Inherited .
2)action: yes <package> Child element of element , Used for configuration Action class . Represents the configuration of a requested action : Find which method of which class .
* grammar :<action name="" class="" method="">
* Common properties :
- name: action The name of , The name and the current action Where package Of namespace Together determine the access path .
visit Action The format of :http://host:port/contextPath/namsspace/actionName[.action]
Be careful :action The name doesn't have /, In the same <package> Can't have the same name .
- class: Action The fully qualified name of the class , It means which one to put Action Object to Strtus2 Framework to manage .
class The default value of :com.opensymphony.xwork2.ActionSupport.
- method: At present action Which method needs to be executed .
method The default value of :execute.
3)result Elements : yes <action/> Child element of element , Indicates the corresponding action The results of the implementation of : `action Which page to output after execution `.
* Grammar format :<result name="" type=""></result>
* classification : First in the current Action In looking for , If you can't find it, look for it <global-results> Medium result, If you can't find → Report errors ;
- overall situation : Configure in <package> In the element <global-results> Elements inside ,<package> All under Action You can jump in .
- Local : Configure in <action> Elements inside , Only in the present Action Middle jump .
$ You need to configure it first global, Then you can configure action
* Common attributes and text :
- name attribute : The same action Medium result Of name Can't have the same name , The name Namely action method . The default value is :success.
- type attribute : Represents the jump mode of a resource ( Request forwarding /URL Redirect ...), These properties are stored in struts-default package . Default :dispatcher.
~ dispatcher: Request forwarding :(Action Request forwarding to JSP), Is the default value .
~ redirect: URL Redirect :(Action Redirect to JSP).
~ chain: Request forwarding :(Action Request forwarding to Action).
~ redirectAction: URL Redirect :(Action Redirect to Action).
~ stream: File download .
- innerText: Indicates the path to jump resources . -->

struts.xml More articles on grammar

  1. Struts.xml Explain

    To solve the problem of network disconnection , We can see the silent problem of configuration file Struts.xml In the case of disconnection , There's an exclamation mark ahead , At this time , We press alt+/ No hints , This is because ” http://struts.apache.org/d ...

  2. Struts2 In the relevant struts-default.xml,struts.xml,struts.properties File,

    1) struts-default.xml This file is struts2 The default configuration file loaded by the framework . It defines struts2 Some of the core bean And interceptors . <?xml version="1.0&qu ...

  3. struts2 in struts.xml Configuration file details

    struts.xml Common configuration of <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts ...

  4. Study Struts--Chap03:struts.xml Common configuration ( Basics )

    1.package attribute name: Package name Used to uniquely specify a package.package You can extend the , When one package Extend from the other one package When package It will add extensions on the basis of its own configuration pac ...

  5. struts.xml The meaning of configuration constants in

    struts.serve.static.browserCache This property sets whether the browser caches static content . When the application is in the development phase , We want to get the latest response from the server for every request , The attribute can be set to false. stru ...

  6. The configuration file Struts.xml in type attribute redirect,redirectAction,chain The difference between

    1.redirect:action Redirect to a view resource after processing ( Such as :jsp page ), All request parameters are missing ,action All the results are lost .  2.redirectAction:action After processing, redirect to a ...

  7. Action There are three ways to realize it ,struts.xml Detailed explanation of configuration and its simple implementation process ( Two )

    Don't do any bad thing no matter how insignificant it looks , No good is too small to be done -------------------------- Liu bei I urge you to , Do more good deeds and accumulate good fortune , Don't be evil The last chapter briefly introduced Struts2 Of ' Two butterflies fly , Hello ' ( One ), If you haven't seen , Please watch ...

  8. 3. analysis struts.xml file

    1. struts.xml File basic configuration : Mainly under the resource path , To configure sturts2 dependent Action , Interceptors, etc <struts> <!-- Set constant --> < ...

  9. 【 Learning notes 】Struts2 Its configuration file struts.xml

    By default ,Struts2 Only automatically load... Under the class loading path struts.xml.default-struts.xml and struts-plugin.xml Three types of documents . But with the increase of application scale , In the system Action Count ...

Random recommendation

  1. HDMI IP Learning notes

    stay HDMI Of IP Click in the core , Generate examples . find ./simulaion/mentor Folder , hold modelsim Path to the path , That's the simulation .

  2. Java Classic examples : Processing a single string

    Use for Circulation and String Object's charAt() Method : perhaps , Use "for each" Circulation and String Object's toCharArray() Method . /** * Created by F ...

  3. ajax request node.js Interface No &#39;Access-Control-Allow-Origin&#39; header is present on the requested resource error

    ajax request node.js The following error occurred in the interface : XMLHttpRequest cannot load http://xxx.xxx.xx.xx:8888/getTem?cityId=110105&a ...

  4. easy ui Drop down cascade effect , Drop down box binding data select Control

    html Code : ① Two drop-down boxes , One is the province , Another city <tr> <td> province :</td> <td> <select id="ProvinceI ...

  5. Within a given range N A different random number

    void RandNumbs(int nLimts, int result[], int n)// Within a given range n Two different random numbers (1-nLimts), And store it to result in { int nNum = 0 ...

  6. wcf to net.tcp Add mex

    <?xml version="1.0" encoding="utf-8" ?><configuration>  <system.s ...

  7. consult &lt;context:component-scan/&gt; and &lt;mvc:annotation-driven/&gt; The difference between 20

    http://www.iteye.com/problems/66133 FileSystemXmlApplicationContext

  8. [ SHELL Programming ] String space and file empty line deletion

    1. Remove spaces in string (1) Remove the space at the beginning of the line (2) Delete the space at the end of the line (3) Before deleting . Space after , Don't delete the middle space (4) Remove all spaces in the string echo " 123 567 " | sed 's ...

  9. Java Must master 20+ Kind of Spring Commonly used annotations

    Spring part 1. Statement bean Annotations @Component Components , No clear role @Service Use in business logic layer (service layer ) @Repository Using in the data access layer (dao layer ) @C ...

  10. linux Too many connections , Lead to ping Analysis of packet loss problem

    1. First of all, make it clear , Whether it's tcp, udp, raw When all this takes up socket, Then it comes to the number of connections . therefore ,linux The problem of connection number , not only tcp The number of connections . 2. View all of the... In the current system socket even ...