public final class StrutsConstants { /** Whether Struts is in development mode or not */ public static final String STRUTS_DEVMODE = "struts.devMode"; /** Whether the localization messages should automatically be reloaded */ public static final String STRUTS_I18N_RELOAD = "struts.i18n.reload"; /** The encoding to use for localization messages */ public static final String STRUTS_I18N_ENCODING = "struts.i18n.encoding"; /** Whether to reload the XML configuration or not */ public static final String STRUTS_CONFIGURATION_XML_RELOAD = "struts.configuration.xml.reload"; /** The URL extension to use to determine if the request is meant for a Struts action */ public static final String STRUTS_ACTION_EXTENSION = "struts.action.extension"; /** 逗号分隔的正则表达式,如果请求路径匹配,则struts不处理 */ public static final String STRUTS_ACTION_EXCLUDE_PATTERN = "struts.action.excludePattern"; /** Whether to use the alterative syntax for the tags or not */ public static final String STRUTS_TAG_ALTSYNTAX = "struts.tag.altSyntax"; /** The HTTP port used by Struts URLs */ public static final String STRUTS_URL_HTTP_PORT = "struts.url.http.port"; /** The HTTPS port used by Struts URLs */ public static final String STRUTS_URL_HTTPS_PORT = "struts.url.https.port"; /** The default includeParams method to generate Struts URLs */ public static final String STRUTS_URL_INCLUDEPARAMS = "struts.url.includeParams"; public static final String STRUTS_URL_RENDERER = "struts.urlRenderer"; /** The com.opensymphony.xwork2.ObjectFactory implementation class */ public static final String STRUTS_OBJECTFACTORY = "struts.objectFactory"; public static final String STRUTS_OBJECTFACTORY_ACTIONFACTORY = "struts.objectFactory.actionFactory"; public static final String STRUTS_OBJECTFACTORY_RESULTFACTORY = "struts.objectFactory.resultFactory"; public static final String STRUTS_OBJECTFACTORY_CONVERTERFACTORY = "struts.objectFactory.converterFactory"; public static final String STRUTS_OBJECTFACTORY_INTERCEPTORFACTORY = "struts.objectFactory.interceptorFactory"; public static final String STRUTS_OBJECTFACTORY_VALIDATORFACTORY = "struts.objectFactory.validatorFactory"; /** The com.opensymphony.xwork2.util.FileManager implementation class */ public static final String STRUTS_FILE_MANAGER_FACTORY = "struts.fileManagerFactory"; /** The com.opensymphony.xwork2.util.fs.FileManager implementation class */ public static final String STRUTS_FILE_MANAGER = "struts.fileManager"; /** The com.opensymphony.xwork2.util.ObjectTypeDeterminer implementation class */ public static final String STRUTS_OBJECTTYPEDETERMINER = "struts.objectTypeDeterminer"; /** The package containing actions that use Rife continuations */ public static final String STRUTS_CONTINUATIONS_PACKAGE = "struts.continuations.package"; /** The org.apache.struts2.config.Configuration implementation class */ public static final String STRUTS_CONFIGURATION = "struts.configuration"; /** The default locale for the Struts application */ public static final String STRUTS_LOCALE = "struts.locale"; /** Whether to use a Servlet request parameter workaround necessary for some versions of WebLogic */ public static final String STRUTS_DISPATCHER_PARAMETERSWORKAROUND = "struts.dispatcher.parametersWorkaround"; /** The org.apache.struts2.views.freemarker.FreemarkerManager implementation class */ public static final String STRUTS_FREEMARKER_MANAGER_CLASSNAME = "struts.freemarker.manager.classname"; @Deprecated /** Cache Freemarker templates, this cache is managed by struts2,instead of native freemarker cache,set STRUTS_FREEMARKER_MRU_MAX_STRONG_SIZE >0&&STRUTS_FREEMARKER_TEMPLATES_CACHE_UPDATE_DELAY>0*/ public static final String STRUTS_FREEMARKER_TEMPLATES_CACHE = "struts.freemarker.templatesCache"; /** Update freemarker templates cache in seconds*/ public static final String STRUTS_FREEMARKER_TEMPLATES_CACHE_UPDATE_DELAY = "struts.freemarker.templatesCache.updateDelay"; /** Cache model instances at BeanWrapper level */ public static final String STRUTS_FREEMARKER_BEANWRAPPER_CACHE = "struts.freemarker.beanwrapperCache"; /** Maximum strong sizing for MruCacheStorage for freemarker */ public static final String STRUTS_FREEMARKER_MRU_MAX_STRONG_SIZE = "struts.freemarker.mru.max.strong.size"; /** org.apache.struts2.views.velocity.VelocityManager implementation class */ public static final String STRUTS_VELOCITY_MANAGER_CLASSNAME = "struts.velocity.manager.classname"; /** The Velocity configuration file path */ public static final String STRUTS_VELOCITY_CONFIGFILE = "struts.velocity.configfile"; /** The location of the Velocity toolbox */ public static final String STRUTS_VELOCITY_TOOLBOXLOCATION = "struts.velocity.toolboxlocation"; /** List of Velocity context names */ public static final String STRUTS_VELOCITY_CONTEXTS = "struts.velocity.contexts"; /** The directory containing UI templates. All templates must reside in this directory. */ public static final String STRUTS_UI_TEMPLATEDIR = "struts.ui.templateDir"; /** The default UI template theme */ public static final String STRUTS_UI_THEME = "struts.ui.theme"; /** Token to use to indicate start of theme to be expanded. */ public static final String STRUTS_UI_THEME_EXPANSION_TOKEN = "struts.ui.theme.expansion.token"; /** The maximize size of a multipart request (file upload) */ public static final String STRUTS_MULTIPART_MAXSIZE = "struts.multipart.maxSize"; /** The directory to use for storing uploaded files */ public static final String STRUTS_MULTIPART_SAVEDIR = "struts.multipart.saveDir"; /** * The org.apache.struts2.dispatcher.multipart.MultiPartRequest parser implementation * for a multipart request (file upload) */ public static final String STRUTS_MULTIPART_PARSER = "struts.multipart.parser"; /** How Spring should autowire. Valid values are 'name', 'type', 'auto', and 'constructor' */ public static final String STRUTS_OBJECTFACTORY_SPRING_AUTOWIRE = "struts.objectFactory.spring.autoWire"; /** Whether the autowire strategy chosen by STRUTS_OBJECTFACTORY_SPRING_AUTOWIRE is always respected. Defaults * to false, which is the legacy behavior that tries to determine the best strategy for the situation. * @since 2.1.3 */ public static final String STRUTS_OBJECTFACTORY_SPRING_AUTOWIRE_ALWAYS_RESPECT = "struts.objectFactory.spring.autoWire.alwaysRespect"; /** Whether Spring should use its class cache or not */ public static final String STRUTS_OBJECTFACTORY_SPRING_USE_CLASS_CACHE = "struts.objectFactory.spring.useClassCache"; /** Whether or not XSLT templates should not be cached */ public static final String STRUTS_XSLT_NOCACHE = "struts.xslt.nocache"; /** Location of additional configuration properties files to load */ public static final String STRUTS_CUSTOM_PROPERTIES = "struts.custom.properties"; /** Location of additional localization properties files to load */ public static final String STRUTS_CUSTOM_I18N_RESOURCES = "struts.custom.i18n.resources"; /** The org.apache.struts2.dispatcher.mapper.ActionMapper implementation class */ public static final String STRUTS_MAPPER_CLASS = "struts.mapper.class"; /** * A prefix based action mapper that is capable of delegating to other * {@link org.apache.struts2.dispatcher.mapper.ActionMapper}s based on the request's prefix * You can specify different prefixes that will be handled by different mappers */ public static final String PREFIX_BASED_MAPPER_CONFIGURATION = "struts.mapper.prefixMapping"; /** Whether the Struts filter should serve static content or not */ public static final String STRUTS_SERVE_STATIC_CONTENT = "struts.serve.static"; /** If static content served by the Struts filter should set browser caching header properties or not */ public static final String STRUTS_SERVE_STATIC_BROWSER_CACHE = "struts.serve.static.browserCache"; /** Allows one to disable dynamic method invocation from the URL */ public static final String STRUTS_ENABLE_DYNAMIC_METHOD_INVOCATION = "struts.enable.DynamicMethodInvocation"; /** Whether slashes in action names are allowed or not */ public static final String STRUTS_ENABLE_SLASHES_IN_ACTION_NAMES = "struts.enable.SlashesInActionNames"; /** Prefix used by {@link CompositeActionMapper} to identify its containing {@link org.apache.struts2.dispatcher.mapper.ActionMapper} class. */ public static final String STRUTS_MAPPER_COMPOSITE = "struts.mapper.composite"; public static final String STRUTS_ACTIONPROXYFACTORY = "struts.actionProxyFactory"; public static final String STRUTS_FREEMARKER_WRAPPER_ALT_MAP = "struts.freemarker.wrapper.altMap"; /** The name of the xwork converter implementation */ public static final String STRUTS_XWORKCONVERTER = "struts.xworkConverter"; public static final String STRUTS_ALWAYS_SELECT_FULL_NAMESPACE = "struts.mapper.alwaysSelectFullNamespace"; /** XWork default text provider */ public static final String STRUTS_XWORKTEXTPROVIDER = "struts.xworkTextProvider"; /** The {@link com.opensymphony.xwork2.LocaleProvider} implementation class */ public static final String STRUTS_LOCALE_PROVIDER = "struts.localeProvider"; /** The name of the parameter to create when mapping an id (used by some action mappers) */ public static final String STRUTS_ID_PARAMETER_NAME = "struts.mapper.idParameterName"; /** The name of the parameter to determine whether static method access will be allowed in OGNL expressions or not */ public static final String STRUTS_ALLOW_STATIC_METHOD_ACCESS = "struts.ognl.allowStaticMethodAccess"; /** The com.opensymphony.xwork2.validator.ActionValidatorManager implementation class */ public static final String STRUTS_ACTIONVALIDATORMANAGER = "struts.actionValidatorManager"; /** The {@link com.opensymphony.xwork2.util.ValueStackFactory} implementation class */ public static final String STRUTS_VALUESTACKFACTORY = "struts.valueStackFactory"; /** The {@link com.opensymphony.xwork2.util.reflection.ReflectionProvider} implementation class */ public static final String STRUTS_REFLECTIONPROVIDER = "struts.reflectionProvider"; /** The {@link com.opensymphony.xwork2.util.reflection.ReflectionContextFactory} implementation class */ public static final String STRUTS_REFLECTIONCONTEXTFACTORY = "struts.reflectionContextFactory"; /** The {@link com.opensymphony.xwork2.util.PatternMatcher} implementation class */ public static final String STRUTS_PATTERNMATCHER = "struts.patternMatcher"; /** The {@link org.apache.struts2.dispatcher.StaticContentLoader} implementation class */ public static final String STRUTS_STATIC_CONTENT_LOADER = "struts.staticContentLoader"; /** The {@link com.opensymphony.xwork2.UnknownHandlerManager} implementation class */ public static final String STRUTS_UNKNOWN_HANDLER_MANAGER = "struts.unknownHandlerManager"; /** Throw RuntimeException when a property is not found, or the evaluation of the espression fails*/ public static final String STRUTS_EL_THROW_EXCEPTION = "struts.el.throwExceptionOnFailure"; /** Logs properties that are not found (very verbose) **/ public static final String STRUTS_LOG_MISSING_PROPERTIES = "struts.ognl.logMissingProperties"; /** Enables caching of parsed OGNL expressions **/ public static final String STRUTS_ENABLE_OGNL_EXPRESSION_CACHE = "struts.ognl.enableExpressionCache"; /** Enables evaluation of OGNL expressions **/ public static final String STRUTS_ENABLE_OGNL_EVAL_EXPRESSION = "struts.ognl.enableOGNLEvalExpression"; /** Disables {@link org.apache.struts2.dispatcher.StrutsRequestWrapper} request attribute value stack lookup (JSTL accessibility) **/ public static final String STRUTS_DISABLE_REQUEST_ATTRIBUTE_VALUE_STACK_LOOKUP = "struts.disableRequestAttributeValueStackLookup"; /** The{@link org.apache.struts2.views.util.UrlHelper} implementation class **/ public static final String STRUTS_URL_HELPER = "struts.view.urlHelper"; /** {@link com.opensymphony.xwork2.conversion.impl.XWorkBasicConverter} **/ public static final String STRUTS_CONVERTER_COLLECTION = "struts.converter.collection"; public static final String STRUTS_CONVERTER_ARRAY = "struts.converter.array"; public static final String STRUTS_CONVERTER_DATE = "struts.converter.date"; public static final String STRUTS_CONVERTER_NUMBER = "struts.converter.number"; public static final String STRUTS_CONVERTER_STRING = "struts.converter.string"; /** Enable handling exceptions by Dispatcher - true by default **/ public static final String STRUTS_HANDLE_EXCEPTION = "struts.handle.exception"; public static final String STRUTS_CONVERTER_PROPERTIES_PROCESSOR = "struts.converter.properties.processor"; public static final String STRUTS_CONVERTER_FILE_PROCESSOR = "struts.converter.file.processor"; public static final String STRUTS_CONVERTER_ANNOTATION_PROCESSOR = "struts.converter.annotation.processor"; public static final String STRUTS_CONVERTER_CREATOR = "struts.converter.creator"; public static final String STRUTS_CONVERTER_HOLDER = "struts..converter.holder"; public static final String STRUTS_EXPRESSION_PARSER = "struts.expression.parser"; /** actions names' whitelist **/ public static final String STRUTS_ALLOWED_ACTION_NAMES = "struts.allowed.action.names"; /** enables action: prefix **/ public static final String STRUTS_MAPPER_ACTION_PREFIX_ENABLED = "struts.mapper.action.prefix.enabled"; /** enables access to actions in other namespaces than current with action: prefix **/ public static final String STRUTS_MAPPER_ACTION_PREFIX_CROSSNAMESPACES = "struts.mapper.action.prefix.crossNamespaces"; public static final String DEFAULT_TEMPLATE_TYPE_CONFIG_KEY = "struts.ui.templateSuffix"; }
相关推荐
### Struts2的常量配置解析 #### 引言 在Java Web开发中,Struts2框架因其灵活...通过以上对Struts2常量配置的深入解析,开发者可以更好地掌握框架的核心机制,优化应用程序的性能,同时增强系统的安全性与可维护性。
### Struts2核心配置文件详解 #### 一、概述 Struts2框架是Java Web开发领域内一个重要的轻量级框架,它简化了基于MVC(Model-View-Controller)设计模式的应用程序开发过程。在Struts2框架中,有两个核心配置文件...
### Struts2配置文件介绍 #### 一、Struts2的核心配置文件 在Struts2框架中,有多个重要的配置文件用于控制应用的行为与结构,其中最核心的是`struts.xml`文件。此外还包括`web.xml`、`struts.properties`、`...
Struts2是一个强大的Java EE应用程序框架,主要用于构建Web应用程序,特别是MVC(Model-View-Controller)架构的应用。...理解和熟练掌握这些配置方式,对于构建高效、可维护的Struts2应用至关重要。
Struts2是一个强大的MVC...总结,Struts2配置文件是其灵活性和可扩展性的关键,理解和掌握配置文件的使用,能有效提升开发效率并优化应用架构。通过合理的配置,开发者可以轻松地构建出满足业务需求的复杂Web应用。
在`struts.xml`中,我们经常看到`<package>`元素,它是Struts2配置的基本单元。每个`<package>`可以包含Action、拦截器、结果和其他配置。`<package>`可以通过继承其他包来复用配置,这使得配置更加模块化和可维护。...
`<constant>`元素用于定义配置文件中的全局常量,它们是Struts2的行为配置。例如: - `struts.i18n.encoding`设置请求的编码格式,如`UTF-8`,确保处理多语言时避免乱码。 - `struts.action.extension`定义了...
### Struts2配置文件及其代码示例解析 #### 一、Struts2概述 Struts2是一个基于MVC模式的开源Web应用框架,它继承了Struts1的优点,并且进行了大量的改进,支持拦截器、结果类型、动态方法调用等功能。在Struts2中...
Struts2是一个强大的MVC(模型-视图-控制器)...总之,Struts2的配置代码是其强大功能的关键,通过合理的配置,可以实现灵活、可扩展的应用架构。理解和掌握这些配置知识点对于开发高效、稳定的Java Web应用至关重要。
理解并正确配置Struts2的基本元素,如Action、Result、Interceptor和常量,是掌握Struts2的关键。同时,了解其生命周期和请求处理流程,有助于更好地设计和调试应用。通过实践Struts2Demo项目,你可以加深对这些概念...
7. **constant**:允许你在配置文件中定义和设置Struts2的常量,这些常量可以改变框架的行为。 在Eclipse中,要启用`struts-2.3.dtd`的代码提示,你需要将DTD文件添加到项目的构建路径中。这通常包括将DTD文件放在...
3. **struts.properties**: 这个文件用于设置Struts2框架的属性,如全局常量和配置选项。例如,你可以在这里配置默认的Result类型、主题和异常处理策略。 4. **struts-default.xml**: 这是一个默认的配置文件,位于...
在Struts2的配置文件(如`struts.xml`)中,可以使用`constant`元素来设置全局的字符编码。例如,设置`struts.i18n.encoding`和`struts.action.response.content.type`常量,确保所有请求和响应都使用统一的编码格式...
通过理解和灵活运用`struts.xml`配置,开发者能够构建出高效、可维护的Struts2应用。同时,配合使用Struts提供的插件和标签库,可以进一步提升开发效率。对于初学者,熟练掌握`struts.xml`的配置是学习Struts2的关键...
Struts 2 的核心配置文件struts.xml,是整个框架的灵魂所在,它负责定义和管理应用中的各种组件,包括但不限于常量、Bean、拦截器、结果类型以及Action的映射等。 ### struts.xml文件结构解析 struts.xml文件的...
Struts2是一个强大的Java EE应用程序...以上是关于Struts2配置文件的基础知识,通过灵活配置,开发者可以构建出高效、可维护的Web应用。在实际开发中,应根据项目需求选择合适的配置方式,确保代码的可读性和可扩展性。
除了上述提到的包、Action以及结果配置外,Struts2还支持全局级别的常量配置。这些常量用于控制Struts2的行为,如设置默认的编码集、启用或禁用某些特性等。 例如,下面是一个简单的常量配置示例: ```xml <struts...
3. **struts.properties**: 用于配置Struts2框架的一些属性,例如全局常量、错误消息显示方式等。 4. **struts-default.xml**: 这是一个默认的配置文件,包含了Struts2的一些预定义设置,通常在struts-core库中。这...
这个配置文件是Struts2的核心,负责定义Action、拦截器、结果页面等关键元素,以实现请求与业务逻辑的映射。下面我们将深入探讨struts.xml的各个方面。 1. **struts.xml概述** struts.xml是Struts2框架的主要配置...