The core of Struts is a struts-config.xml configuration file that describes all Struts components in this file. Here, the main components and the secondary components are included here, and the following is the content of struts-config.xml containing the main elements:
First, the main elements of Struts-config.xml:
Xml Version = "1.0" encoding = "ISO-8859-1"?>
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
data-source>
data-sources>
form-beans>
global-forwards>
action-mappings>
Struts-Config>
Note: The order of the above elements is very important, your struts-config.xml configuration file must be configured in this order, otherwise it will be wrong when your container is started.
Second, Struts-Config.xml child elements:
1.
It contains
/IMages/smalllogo.gif
small-icon>
/IMAGES /LARGOGO.GIF
large-icon>
icon>
2.
It provides information on short textuals of the parent element, as follows:
Short Textual Discription of ITS Parent Element
display-name>
3.
It provides information about the full-length textual (Full-Length Textual), as follows:
Full-Length Textual Discription of Its Parent Element
description>
4.
It is used to set the property value of the JavaBean set in its parent element, which is generally used in the specified genericDataSource property, extended actionmappings, and extension of Global Forwards. As follows: Property = "Name of Bean Property" Value = "Value of Bean Property" /> E.g: Third, configure the JDBC data source Its configuration form is as follows: data-source> data-sources> Attribute description information Key Binds the index key of the DataSource instance on servletContext, if not set, default is an action.data_source_key, if there is more than one DataSource in the application, you must set the value of the key. JDBC driver (must) used by DriverClass, such as: com.microsoft.jdbc.sqlserver.sqlserdriver The URL of the JDBC used in the URL (must), such as: JDBC: Microsoft: SQLServer: // XG088: 1433Maxcount At the same time, the maximum election is opened at the same time, the default is 2 (optional) Mincount also opens minimum coupons, the default is 1 (optional) User links to the user name (must) Password links to the password of the database (must) Description Information About DataSource (optional) Readonly If set to True, the link is read-only, default is false. (Optional) LogintimeOut creates the maximum allowable time of the link, in seconds. (Optional) AutoCommit If you are True, you will force rollback every time execute. Default is true. (Optional) for example: data-source> data-sources> Fourth, configure FORMBEAN Type = "full Qualified Class Name of Formbean" /> form-beans> example: form-beans> Five, configure global forwarding Global forwarding can define several global-forwards> In addition to the Name and Path properties, there is a redirect property. When Redirect is set to TRUE, use the httpservletresponse.sendredirect () method, otherwise, default is false. Note: If true, use the httpservletResponse.sendredirect () method, the value stored in the original HTTPSERVLETREQUEST will be lost. example: global-forwards> Sixth, configure It can define a few Type = "full Qualified Class Name of the Action CLASS" Name = "The name of the form bean bound to this action">