`
as619864232
  • 浏览: 324286 次
社区版块
存档分类
最新评论

Struts2 中的零配置的常量

阅读更多

 

Configuration reference

Add a constant element to your struts config file to change the value of a configuration setting, like:

<constant name="struts.convention.result.path" value="/WEB-INF/mytemplates/"/>

 
                    Name                                                  Default Value                                           Description

struts.convention.action.
        alwaysMapExecute
true Set to false, to prevent Convention from  creating a default mapping to "execute" when there are other methods annotated as actions in the class
struts.convention.action.
        includeJars
Comma separated list of regular expressions of jar URLs to be scanned. eg. ".myJar-0\.2.,.thirdparty-0\.1."
struts.convention.action.
         packages
An optional list of action packages that this should create configuration for (they don't need to match a locator pattern)
struts.convention.result.
         path
/WEB-INF/content/ Directory where templates are located
struts.convention.result.
         flatLayout
true If set to false, the result can be put in its own directory: resultsRoot/namespace/actionName/result.extension
struts.convention.action.
         suffix
Action Suffix used to find actions based on class names
struts.convention.action.
         disableScanning
false Scan packages for actions
struts.convention.action.
         mapAllMatches
false Create action mappings, even if no @Action is found
struts.convention.action.
         checkImplementsAction
true Check if an action implements com.opensymphony.xwork2.Action to create an action mapping
struts.convention.default.
         parent.package
convention-default Default parent package for action mappins
struts.convention.action.
         name.lowercase
true Convert action name to lowercase
struts.convention.
         action.name.separator
- Separator used to build the action name, MyAction -> my-action. This character is also used as the separator between the action name and the result in templates, like action-result.jsp
struts.convention.
         package.locators
action,actions,struts,
struts2
Packages whose name end with one of these strings will be scanned for actions
struts.convention.package.
         locators.disable
false Disable the scanning of packages based on package locators
struts.convention.exclude.
         packages
org.apache.struts.*,
org.apache.struts2.*,
org.springframework.
       web.struts.*,
org.springframework.
       web.struts2.*,
org.hibernate.*
Packages excluded from the action scanning
struts.convention.package.
         locators.basePackage
If set, only packages that start with its value will be scanned for actions
struts.convention.relative.
         result.types
dispatcher,velocity,
freemarker
The list of result types that can have locations that are relative and the result location (which is the resultPath plus the namespace) prepended to them
struts.convention.redirect.
         to.slash
true A boolean parameter that controls whether or not this will handle unknown actions in the same manner as Apache, Tomcat and other web servers. This handling will send back a redirect for URLs such as /foo to /foo/ if there doesn't exist an action that responds to /foo
struts.convention.classL
         oader.excludeParent
true Exclude URLs found by the parent class loader from the list of URLs scanned to find actions (needs to be set to false for JBoss 5)
struts.convention.action.eagerLoading false If set, found action classes will be instantiated by the ObjectFactory to accelerate future use, setting it up can clash with Spring managed beans

 

分享到:
评论

相关推荐

    Struts2配置精要之常量constant配置详解(包括零配置Convention 的常量)

    本文将深入探讨Struts2中的常量配置,包括基本的XML配置以及零配置的Convention模式下的常量设定。 首先,让我们了解Struts2框架中的常量配置。这些常量定义在`struts-default.xml`和`struts-plugin.xml`等配置文件...

    简述STRUTS2_Convention零配置

    STRUTS2 Convention 零配置是Struts2框架中的一种高级特性,旨在简化应用程序的配置,让开发者能够更快地构建MVC应用。从Struts2.1版本开始,推荐使用Convention插件替代Codebehind插件,因为它更加自动化,几乎无需...

    struts2采用convention-plugin实现零配置

    在Struts2的某个版本之后,引入了一项名为`convention-plugin`的新特性,旨在简化配置过程,实现所谓的“零配置”开发。这个插件允许开发者通过约定而非显式配置来设置Action类、结果页面等,从而减少了XML配置文件...

    STRUTS2零配置.doc

    Struts2是一款流行的Java web开发框架,其零配置特性始于版本2.1,主要通过引入Convention插件实现。Convention插件旨在简化应用配置,避免过度依赖XML或注解,通过预定义的规则自动配置Action、结果视图以及Action...

    Struts2.1零配置——convention-plugin

    Struts2.1引入了Convention Plugin,以实现框架的零配置目标,替代之前的Codebehind Plugin。这个插件通过约定优于配置的原则简化了Struts2的应用开发,减少了XML配置文件的需求。以下是对Convention Plugin主要特性...

    struts2的Convention插件说明书(中文版)

    Struts2的Convention插件是一种自动化配置工具,从2.1版本开始引入,旨在减少XML配置,实现Struts2应用的零配置或者最少配置。该插件通过一系列预定义的命名规则和约定,自动解析和映射Action、结果页面、拦截器等...

    struts2 annotation 注解使用

    从 Struts2.1 版本开始,官方不再推荐使用 Codebehind 插件,转而采用 Convention 插件来实现零配置。与 Codebehind 相比,Convention 插件更为彻底,它完全摒弃了配置文件,既不需要使用 `struts.xml` 文件进行配置...

    Struts2随手笔记

    Convention插件使得Struts2可以实现“零配置”开发,即通过类名和方法名自动映射Action和结果。例如,类名为`UserAction`的方法`save()`可以直接映射到URL `/user/save.action`。 5. **Struts2注解**: - **...

    struts2课件

    在`web.xml`文件中配置Struts2的核心过滤器`StrutsPrepareAndExecuteFilter`,这是启动Struts2的关键步骤之一。 3. **第三步:创建Action** 创建一个继承自`ActionSupport`类的Action类。例如,可以创建一个名为...

    Struts2注解使用说明

    Struts2中的注解主要包括: - `@Action`:用于标记一个Action类,并可以指定访问路径、结果等信息。 - `@Result`:用于定义Action执行后的结果视图。 - `@Namespace`:用于指定Action的名称空间。 - `@Parent...

    struts2注解使用.doc

    在Struts2的早期版本中,Codebehind插件被用来实现零配置,但自Struts2.1开始,它被Convetion插件所取代,因为Convetion插件提供了更为全面的自动化配置能力。 **Convetion插件** 是Struts2的核心组成部分之一,它...

    struts2+hibernate+spring三大框架技术

    - **Spring与Struts2集成**:Spring可以用来管理Struts2中的Action对象,提供依赖注入等功能。 - **Spring与Hibernate集成**:Spring提供了一种统一的事务管理机制,使得Hibernate的使用更加简单和一致。 **总结** ...

    struts2学习笔记1-HelloWorld项目

    在Struts2中,配置是非常关键的。我们需要在`struts.xml`配置文件中定义Action,指定其类名、方法以及对应的URL映射。例如: ```xml &lt;result name="success"&gt;/HelloWorld.jsp ``` 这段配置表示当用户访问`/...

    Struts2.0中文教程

    - **OGNL在Struts2中的应用**:Action属性访问、表单回填、结果值传递等。 6. **结果映射(Result Mapping)** - **结果配置**:在`.struts.xml`中定义Action执行成功或失败后应跳转的页面或资源。 - **动态结果...

    struts2-Convention插件使用

    自Struts2.1版本起,Convention插件被引入,旨在替代原有的Codebehind插件,实现框架内的零配置理念。这一插件的设计思想围绕着减少XML配置的依赖,通过代码结构与命名规则自动推断应用程序的行为,从而简化开发流程...

    Struts in Action 中文修正版.pdf

    - 介绍了Struts框架中除了`struts-config.xml`之外的其他配置文件及其作用。 - **Web应用部署描述符** - 解释了`web.xml`文件在Struts应用中的重要性及配置方法。 通过上述内容,我们可以看出,《Struts In ...

Global site tag (gtag.js) - Google Analytics