Struts1关于struts-config.xml中的controller标签

官方文档对于controller的描述为:

The <controller> element allows you to configure the ActionServlet. Many of the controller parameters were previously defined by servlet initialization parameters in your web.xml file but have been moved to this section of struts-config.xml in order to allow different modules in the same web application to be configured differently.

翻译:

<controller>标签允许我们配置ActionServlet。大多数的控制器参数,都在web.xml文件中由servlet初始化参数预先配置好了;但是在struts-config.xml中(通过controller标签)配置这些参数的意义在于:一个web应用中的不同模块可以通过多种方式进行配置;

的确,controller标签中可以有多种属性可以进行配置

  • bufferSize - The size (in bytes) of the input buffer used when processing file uploads. [4096] (optional)
  • catalog - Name of the catalog to use when processing requests for this module. [struts]
  • className - Classname of configuration bean. [org.apache.struts.config.ControllerConfig] (optional)
  • command - Name of the command to execute to process a request. [servlet-standard]
  • contentType - Default content type (and optional character encoding) to be set on each response. May be overridden by the Action, JSP, or other resource to which the request is forwarded. [text/html] (optional)
  • forwardPattern - Replacement pattern defining how the "path" attribute of a <forward>element is mapped to a context-relative URL when it starts with a slash. This value may consist of any combination of the following:
    • $M - Replaced by the module prefix of this module.
    • $P - Replaced by the "path" attribute of the selected <forward> element.
    • $$ - Causes a literal dollar sign to be rendered.
    • $x - (Where "x" is any character not defined above) Silently swallowed, reserved for future use.
    If not specified, the default forwardPattern is consistent with the previous behavior of forwards. [$M$P] (optional)
  • inputForward - Set to true if you want the input attribute of <action> elements to be the name of a local or global ActionForward , which will then be used to calculate the ultimate URL. Set to false to treat the input parameter of <action> elements as a module-relative path to the resource to be used as the input form. [false] (optional)
  • locale - Set to true if you want a Locale object stored in the user's session if not already present. [true] (optional)
  • maxFileSize - The maximum size (in bytes) of a file to be accepted as a file upload. Can be expressed as a number followed by a "K", "M", or "G", which are interpreted to mean kilobytes, megabytes, or gigabytes, respectively. [250M] (optional)
  • memFileSize - The maximum size (in bytes) of a file whose contents will be retained in memory after uploading. Files larger than this threshold will be written to some alternative storage medium, typically a hard disk. Can be expressed as a number followed by a "K", "M", or "G", which are interpreted to mean kilobytes, megabytes, or gigabytes, respectively. ["256K"]
  • multipartClass - The fully qualified Java class name of the multipart request handler class to be used with this module. [org.apache.struts.upload.CommonsMultipartRequestHandler] (optional)
  • nocache - Set to true if you want the controller to add HTTP headers for defeating caching to every response from this module. [false] (optional)
  • pagePattern - Replacement pattern defining how the pageattribute of custom tags using it is mapped to a context-relative URL of the corresponding resource. This value may consist of any combination of the following:
    • $M - Replaced by the module prefix of this module.
    • $P - Replaced by the "path" attribute of the selected <forward> element.
    • $$ - Causes a literal dollar sign to be rendered.
    • $x - (Where "x" is any character not defined above) Silently swallowed, reserved for future use.
    If not specified, the default pagePattern is consistent with the previous behavior of URL calculation. [$M$P] (optional)
  • processorClass - The fully qualified Java class name of the RequestProcessor subclass to be used with this module. [org.apache.struts.chain.ComposableRequestProcessor] (optional)
  • tempDir - Temporary working directory to use when processing file uploads. [{the directory provided by the servlet container}]
posted @ 2011-10-30 21:54  JaredLam  阅读(3495)  评论(0编辑  收藏  举报