Download Struts2 and struts2

Source: Internet
Author: User

Download Struts2 and struts2

Three methods for configuring struts2 constants:

1. Use the <constant> element in struts. xml to configure eg: <constant name = "struts. action. extension" value = "true">

2. Configure eg: struts. action. extension = true in the struts. properties file.

3. Configure the StrutsPrepareAndExecuteFilter parameter in web. xml.

Eg:

<Param-name> struts. action. extension </param-name>
<Param-value> true </param-value>

Priority relationship: web. xml> struts. properties> struts. xml

 

<? Xml version = "1.0" encoding = "UTF-8"?> <! DOCTYPE struts PUBLIC "-// Apache Software Foundation // DTD Struts Configuration 2.3 // EN" "http://struts.apache.org/dtds/struts-2.3.dtd"> <struts> <! -- Set it to development mode and false when publishing --> <constant name = "struts. devMode" value = "true"/> <! -- Set whether to perform hot loading when the class is modified and false when publishing --> <constant name = "struts. convention. classes. reload "value =" true "/> <! -- Call an automatic dynamic method. After using this setting, you can call: action! Method --> <constant name = "struts. enable. DynamicMethodInvocation" value = "true"/> <! -- Specify the directory address of the jsp file --> <constant name = "struts. convention. result. path" value = "/WEB-INF/content/"/> <! -- Use the struts-default converter. for rest, use rest-default. for rest, use the rest jar plug-in --> <constant name = "struts. convention. default. parent. package "value =" struts-default "/> <! -- Used to configure the package name suffix. The default values are action, actions, and struts --> <constant name = "struts. convention. package. locators" value = "actions"/> <! -- Used to configure the class name suffix. The default value is Action. After setting, Struts2 will only find the class with this suffix for ing --> <constant name = "struts. convention. action. suffix "value =" Action "/> <! -- Creates an Action ing even if there is no @ Action annotation. The default value is false. Because Convention-Plugin is a style better than the configuration, you can access the methods in the corresponding Action without using annotations according to the pre-defined --> <constant name = "struts. convention. action. mapAllMatches "value =" true "/> <! -- Customize the delimiter for naming jsp files --> <constant name = "struts. convention. action. name. separator" value = "-"/> <! -- Name of the international resource file --> <constant name = "struts. custom. i18n. resources" value = "i18n"/> <! -- Whether to automatically load international resource files --> <constant name = "struts. i18n. reload" value = "true"/> <! -- Whether the browser caches static content --> <constant name = "struts. serve. static. browserCache" value = "false"/> <! -- Restrict the size of uploaded files --> <constant name = "struts. multipart. maxSize" value = "-1"/> <! -- Topic, set the value to simple, that is, do not use the UI template. This will not generate additional html tags --> <constant name = "struts. ui. theme" value = "simple"/> <! -- Encoding format --> <constant name = "struts. i18n. encoding" value = "UTF-8"/> </struts>

 

Basic Constants
  • Struts. devModeOptional values: true and false (default value: false). In development mode, the function of dynamic reload configuration and resource file of struts2 takes effect by default. In the development mode, more comprehensive log support is also provided.
  • Struts. i18n. reloadOptional values: true and false (the default value depends on struts. devMode). Whether to automatically reload local resource files.
  • Struts. i18n. encodingIt is mainly used to Set Request Encoding (default value (UTF-8), Head, and Include label resolution encoding. The parsing code of the resource and configuration file.
  • Struts. configuration. xml. reloadOptional values: true and false (the default value depends on struts. devMode). Whether to automatically reload the XML configuration file
  • Struts. action. extensionSet the suffix of the struts Action request, which can be separated by commas.
  • Struts. action. excludePatternSet the URLs excluded by struts (matching by regular expressions) (multiple URLs are supported and separated by commas)
  • Struts. tag. altSyntaxOptional values: true and false (default value: true). Whether ognl expressions are supported.
  • Struts. url. http. portSet the http port corresponding to the generated URL
  • Struts. url. https. portSet the https port corresponding to the generated URL
  • Struts. url. includeParamsOptional values: none, get, and all (get by default). Set whether the URL contains parameters and whether only GET parameters are included.
  • Struts. localeSet struts2's default locale to determine which resource file to use.
  • Struts. ui. templateDirThis attribute specifies the location of the template file required for the view topic. The default value of this attribute is template, that is, the template file under the template path is loaded by default.
  • Struts. ui. themeThis attribute specifies the default view topic of the view label. The default value of this attribute is xhtml.
  • Struts. ui. templateSuffixThis attribute specifies the suffix of the template file. The default attribute value of this attribute is ftl. This attribute also allows ftl, vm, or jsp to correspond to FreeMarker, Velocity, and JSP templates respectively.
  • Struts. multipart. saveDirSet the default directory for uploading temporary files
  • Struts. multipart. maxSizeSets the maximum size of temporary files to be uploaded.
  • Struts. objectFactory. spring. autoWireOptional values (name, type, auto, constructor, name) (default name) are used to set the automatic assembly method of spring, which is valid only after the spring plug-in is introduced.
  • Struts. objectFactory. spring. autoWire. alwaysRespect(False by default) sets whether to always create objects using an automatic assembly policy.
  • Struts. objectFactory. spring. useClassCache(False by default) whether the object factory uses class cache. The development mode is invalid.
  • Struts. xslt. nocache(The default value is false.) set whether the primary tresult is not cached.
  • Struts. custom. propertiesSet a list of user-defined property file names (separated by commas)
  • Struts. custom. i18n. resourcesSet a list of Custom Resource file paths (separated by commas)
  • Struts. serve. static(False by default) sets whether static resource requests are supported (the url must be in struts or static mode)
  • Struts. serve. static. browserCache(False by default) whether to set the cache in the static resource response. Valid only when static resources are supported.
  • Struts. el. throwExceptionOnFailure(False by default) whether to throw a RuntimeException when parsing the el expression or when the attribute cannot be found
  • Struts. ognl. logMissingProperties(False by default) whether the log is not found
  • Struts. ognl. enableExpressionCacheIndicates whether to cache the expressions parsed by ognl.
  • Struts. enable. DynamicMethodInvocation(False by default) whether dynamic method calling is supported. It passes through the URL! Method.
  • Struts. enable. SlashesInActionNamesDoes the Action segment in the URL support diagonal lines?
  • Struts. mapper. alwaysSelectFullNamespace(False by default) Whether to always use the URL segment before the last diagonal line as the namespace
Core object Constants
  • Struts. actionProxyFactorySets the entity factory of ActionProxy, which also generates the default ActionInvoctation.
  • Struts. xworkConverterSets the XWorkConverter object, which is used to obtain various types of converters.
  • Struts. unknownHandlerManagerSets the implementation class of UnknownHandlerManager to handle exceptions such as method failure.
  • Struts. multipart. handlerSet the handler (jakarta by default) corresponding to mutipartRequest, org. apache. struts2.dispatcher. multipart. JakartaMultiPartRequest
  • Struts. mapper. classOptional values (struts, composite, restful, restful2) set the implementation of URL parsing and ing to ACTION (default struts ).
  • Struts. mapper. prefixMappingIng the URL prefix to the corresponding er ER in the format of urlPrefix1: mapperName2 and urlPrefix2: mapperName2. You must add mapperClass to org. apache. struts2.dispatcher. mapper. PrefixBasedActionMapper and specify struts. mapper. class As The mapper.
  • Struts. mapper. compositeSets whether compound (multiple) actionMapper is supported. mappernames are separated by commas. Struts. mapper. class must be configured as composite to take effect.
  • Struts. mapper. idParameterNameUsed for Restful2ActionMapper as the parameterName corresponding to the id in the URL
  • Struts. ognl. allowStaticMethodAccess(False by default) specifies whether the ognl expression supports static methods.
  • Struts. configurationSets the Settings class of struts2. (Not used after 2.1.2)
  • Struts. urlRendererSet struts2 URL render (used to generate the URL), (default struts), Class Name org. apache. struts2.components. ServletUrlRenderer
  • Struts. objectFactorySets struts2's object factory, default (struts), Class Name org. apache. struts2.impl. StrutsObjectFactory, when introduced to the struts2-spring plug-in, is modified to org. apache. struts2.spring. StrutsSpringObjectFactory
  • Struts. xworkTextProviderSet struts2 resource file content to provide class implementation. The default value is com. opensymphony. xwork2.TextProviderSupport.
  • Struts. actionValidatorManagerSets the implementation class of ActionValidatorManager.
  • Struts. valueStackFactorySet the implementation of struts2's ValueStack factory.
  • Struts. reflectionProviderSet the implementation class of ReflectionProvider
  • Struts. reflectionContextFactorySet the implementation class of ReflectionContextFactory
  • Struts. patternMatcherSet the implementation class of PatternMatcher
  • Struts. staticContentLoaderSet the implementation class of StaticContentLoader

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.