This property struts.objectFactory is used to illustrate the object pool creation factory of Struts2. Struts2 also has its own object pool. Just like Spring, you can refer to objects in the object pool in the configuration file. You can use the object pool in Spring. When you want to get the object pool in Spring, declare that struts.objectFactory is the object pool in Spring.
struts.serve.static.browserCache This property sets whether the browser caches static content. When the application is in development stage, we want each request to get the latest response from the server, so we can set this property to false.
struts.enable.DynamicMethodInvocation This property sets whether Struts 2 supports dynamic method calls, and the default value of this property is true. If you need to turn off dynamic method calls, you can set this property to false.
struts.enable.SlashesInActionNames This property sets whether Struts 2 allows slashes to be used in Action names. The default value of this property is false. If the developer wants to allow slashes in the Action name, then the property can be set to true.
struts.tag.altSyntax This property specifies whether to allow expression syntax in Struts 2 tags. Because expression syntax is usually required in tags, this property should be set to true, and the default value of this property is true.
struts.devMode This property sets whether the Struts 2 application uses development mode. If this property is set to true, more and more friendly error prompts can be displayed when an error occurs on an application. This property only accepts two values: true and flase, and the default value of this property is false. Usually, when the application is in the development stage, the property is set to true, and when it enters the product release stage, the property is set to false.
struts.i18n.reload This property sets whether the system reloads the resource file every time an HTTP request arrives. The default value of this property is false. Setting this property to true during the development phase will be more conducive to development, but it should be set to false during the product release phase.
The prompt is to set true in the development stage, which will reload the international resource file every time you request, so that developers can see real-time development effects; the product release stage should set this property to false to provide responsive performance. Reloading the resource file for each request will greatly reduce the performance of the application.
struts.ui.theme This property specifies the default view theme of the view tag, and the default value of this property is xhtml.
struts.ui.templateDir This property specifies the location of the template file required for the view theme. The default value of this property is template, that is, the template file under the template path is loaded by default.
struts.ui.templateSuffix This property specifies the suffix of the template file, and the default property value of this property is ftl. This property also allows the use of ftl, vm, or jsp, corresponding to FreeMarker, Velocity and JSP templates, respectively.
struts.configuration.xml.reload This property sets whether the system will automatically reload the file after the struts.xml file is changed. The default value of this property is false.
struts.velocity.configfile This property specifies the location of the velocity.properties file required by the Velocity framework. The default value of this property is velocity.properties.
struts.velocity.contexts This property specifies the Context position of the Velocity framework. If the framework has multiple Contexts, the multiple Contexts are separated by English commas (,).
struts.velocity.toolboxlocation This property specifies the location of the toolbox of the Velocity framework.
struts.url.http.port This property specifies the listening port on which the web application is located. This property usually does not have much user, but only when Struts 2 needs to generate a URL (such as a Url tag) this property provides the default port for the web application.
struts.url.https.port This property is similar to the role of struts.url.http.port property, the difference is that this property specifies the encryption service port of the web application.
struts.url.includeParams This property specifies whether Struts 2 contains request parameters when generating the URL. This property accepts three attribute values: none, get and all, which correspond to not including, only including GET type request parameters and including all request parameters.
struts.custom.i18n.resources This property specifies the international resource file required by Struts 2 applications. If there are multiple international resource files, the file names of the multiple resource files are separated by English commas (,).
struts.dispatcher.parametersWorkaround For some Java EE servers, the HttpServlet Request calls getParameterMap() method is not supported. At this time, you can set the property value to true to solve the problem. The default value of this property is false. For WebLogic, Orion, and OC4J servers, this property should usually be set to true.
struts.freemarker.manager.classname This property specifies the FreeMarker manager used by Struts 2. The default value of this property is org.apache.struts2.views.freemarker.FreemarkerManager, which is the built-in FreeMarker manager for Struts 2.
struts.freemarker.wrapper.altMap This property only supports two attribute values: true and false, and the default value is true. Usually there is no need to modify the property value.
struts.xslt.nocache This property specifies whether XSLT Result uses stylesheet cache. This property is usually set to true when the application is in the development stage; this property is usually set to false when the application is in the product usage stage.
struts.configuration.files This property specifies the configuration file loaded by the Struts 2 framework by default. If you need to specify that multiple configuration files are loaded by default, the file names of the multiple configuration files are separated by English commas (,). The default value of this property is struts- default.xml, struts-plugin.xml, struts.xml. When you see the value of this property, readers should understand why the Struts 2 framework loads the struts.xml file by default.
Detailed explanation of spring in struts2-plugin.xml
<struts> <bean type="com.opensymphony.xwork2.ObjectFactory" name="spring" /> <!-- Make the Spring object factory the automatic default --> <constant name="struts.objectFactory" value="spring" /> <package name="spring-default"> <interceptor name="autowiring"/> <interceptor name="sessionAutowiring"/> </interceptors> </package> </struts
Note <constant name="structs.objectFactory" value="spring"/>
Here it overwrites the framework constant struts.objectFactory and sets it to "spring". In fact, the abbreviation is used here. We can write the full name: org.apache.struts2.spring.StrutsSpringObjectFactory. The abbreviation "spring" corresponds to the name attribute in the bean configuration. By default, all objects created by the framework are instantiated by ObjectFactory, which provides methods to integrate with other IoC containers such as Spring, Pico, etc. The class that overrides this ObjectFactory must inherit the ObjectFactory class or any subclass of it, and must carry a constructor without parameters. Here we use org.apache.struts2.spring.StrutsSpringObjectFactory instead of the default ObjectFactory.
In addition, we said above that if the action is not created using Spring ObjectFactory, the plug-in provides two interceptors to automatically assemble the action. By default, the automatic assembly strategy used by the framework is name, which means that the framework will search for beans with the same name as the action attribute in Spring. The optional assembly strategies include: type, auto, and constructor. We can set it through the constant structures.objectFactory.spring.autoWire.
In this way, we can use the beans injected in Spring IOC in Action. In fact, this is a feature in the expansion package that webwork has long been available. hehe. If you change to strut2.0, you still have to say it.
With the above configuration file, we can combine Spring 2.0 and struts 2.0.