Struts-config.xml configuration file explanation (2)

xiaoxiao2021-03-06  56

Attributes and its description information are as follows:

Attribute description information

Characters entered in the URL of the browser (must)

TYPE links to the full name of the Action of this map (optional)

Name is defined in in (optional)

Scope Specifies the scope of the Actionform Bean (session and request), default is session. (Optional)

INPUT returns the control when the bean has an error. (Optional)

ClassName Specifies a full name of an ActionMApping class that calls this Action class. By default org.apache.struts.action.actionmapping, (optional)

Forward specifies the JSP page corresponding to the corresponding request. (Optional)

Include If there is no Forward, it starts the role of Forward. (Optional)

Validate If you are True, you will call an ActionForm's validate () method, otherwise it is not called, default is TRUE. (Optional)

example:

Type = "wiley.lookupaction"

Name = "lookupform"

Scope = "request"

Validate = "True"

INPUT = "/ index.jsp">

7. Configuring RequestProcessor

Use the child element in the struts-config.xml file to define the RequestProcessor, whose syntax format is as follows:

Element Properties and Its Description Information are as follows:

Property description

ProcessorClass Specifies the full name of a custom RequestProcessor class

Buffersize specifies the cache size used to download. The default is 4096 bytes.

ContentType defines the response text type, the default is Text / HTML

Debug Defines the extension level of the current system, the default is 0

Locale If it is true, save the Locale object in the user's session, default to true

MaxFileSize specifies the maximum size of the download file. The default is 250m

MultipartClass specifies the full name of the class that instead of org.apache.struts.upload.diskmultipartRequestHandler classes.

Nocache If it is true, close the cache function of each response is turned off. The default is FalseTempdir Specifies the temporary directory used to upload files. The default value is determined by the container

example:

1

2

ContentType = "text / html; charSet = UTF-8"

Debug = "3"

Locale = "True"

Nocache = "true"

Processorclass = "Org.apache.struts.Action.RequestProcessor" />

Eight, configure Message Resources

Use the element in the struts-config.xml file to define the message resource. The syntax is as follows:

element properties and its description information are as follows:

Property description

Parameter gives a full name of the resource file

ClassName Defines the full name of the class name that handles the message resource, the default is org.apache.struts.config.MessageResourcesconfig

Factory defines the full name of the MessageResourcesFactory class, the default is org.apache.struts.util.Property.MessageResourcesFacotry

Key Defines the properties of the servletContext binding in this resource package, the default is Action.Messages_Key.

Null If you are TRUE, you can't find the message key, then return null, the default is TRUE.

example:

1

2

Parameter = "StorefrontMessageResources"

null = "false" />

Key = "Image_Resource_Key"

Parameter = "StorefrontimageResources"

null = "false" />

Note: The purpose of setting Key is as follows:

Here, you will find the value of the main key value in the StoreFrontimageResources.properties resource file is "Navbar.home.Image".

The content of StorefrontimageResources.properties here is as follows:

......

Navbar.home.Image = / images / home.gifnavbar.home.image.alt = home

......

Here, Navbar.home.Image.alt illustrates and home.

Nine, configure PLUG-IN

Configure Plug-in as follows:

It can also be as follows:

转载请注明原文地址:https://www.9cbs.com/read-118149.html

New Post(0)