| < Day Day Up > |
|
The <controller> element is used to define a ControllerConfig bean (org.apache.struts.config.ControllerConfig) that represents an application's runtime module configuration. The syntax of the <controller> element is:
<global-forwards> <forward name="unique target identifier" path="context-relative path to targeted resource "/> </global-forwards>
Table 15.8 describes the attributes of a <controller> sub-element.
Attribute | Description |
---|---|
bufferSize | Defines the size of the available input buffer when uploading files. (optional) |
className | Specifies the fully qualified class name of the configuration class that is defined by this <controller> element. This class must be derived from org.apache.struts.config.ControllerConfig, which is also the default value. (optional) |
contentType | Indicates the content type of each response. The default value is text/html. (optional) |
inputForward | If set to true, the input attribute of all <action> elements will be used as the name of a defined forward. If this attribute is set to false, then the input name will be used as a module-relative path. The default value is false. (optional) |
locale | If set to true, then the user's Locale will be placed in his or her HttpSession. If the Locale is already in the HttpSession, then it will be ignored. The default value is true. (optional) |
maxFileSize | Represents the maximum file size (in bytes) of a single file upload. The value can be expressed as K (kilobytes), M (megabytes), or G (gigabytes). The default value is 250M. (optional) |
memFileSize | Represents the maximum file size (in bytes) of a single file whose contents remain in memory after a file upload. The value can be expressed in as K (kilobytes), M (megabytes), or G (gigabytes). The default value is 256K. (optional) |
multipartClass | Identifies the fully qualified class name of a multipart request handler class to be used when uploading files. The default value is org.apache.struts.upload.CommonsMultipartRequestHandler. (optional) |
nocache | If this attribute is set to true, the controller adds HTTP headers for defeating HTTP caching to every response. The default value is false. (optional) |
processorClass | Specifies the fully qualified class name of the RequestProcessor subclass that will be used when processing each request associated with the containing module. The default value is org.apache.struts.action.RequestProcessor. (optional) |
tempDir | A temporary working directory that is used to hold files when processing uploads. The default value is named by the JSP/servlet container. (optional) |
The following code snippet uses the <controller> sub-element:
<controller processor nocache="true" />
This example changes the default RequestProcessor to the ch04.WroxRequestProcess, which was used in Chapter 4, "Actions and the ActionServlet," and ensures that all responses from this module will not be cached.
| < Day Day Up > |
|