转自:http://chenjumin.iteye.com/blog/668389

1、常量说明

       struts.convention.result.path="/WEB-INF/content/": 结果页面存放的根路径,必须以 "/" 开头。
struts.convention.action.suffix="Action": action名字的获取
struts.convention.action.name.lowercase="true": 是否将Action类转换成小写
struts.convention.action.name.separator="-":
struts.convention.action.disableScanning="false": 是否不扫描类。
struts.convention.default.parent.package="convention-default":设置默认的父包。
struts.convention.package.locators="action,actions,struts,struts2": 确定搜索包的路径。
struts.convention.package.locators.disable="false":
struts.convention.package.locators.basePackage="":
struts.convention.exclude.packages="org.apache.struts.*,org.apache.struts2.*,org.springframework.web.struts.*,org.springframework.web.struts2.*,org.hibernate.*": 排除哪些包不搜索。
struts.convention.relative.result.types="dispatcher,velocity,freemarker": 默认返回的结果类型搜索。
struts.convention.result.flatLayout="true": 是否结果类型作为文件名的一部分。假如结果返回值为error,则true时为hello_world_error.jsp,false时为hello_world/error.jsp。
struts.convention.classes.reload="false" : struts.convention.action.mapAllMatches="false":
struts.convention.action.checkImplementsAction="true":
struts.mapper.alwaysSelectFullNamespace="true":
struts.convention.redirect.to.slash="true":
struts.convention.action.alwaysMapExecute="true":
struts.convention.action.fileProtocols="jar" :

2、默认约定

Action名的映射:去掉Action后缀,单词之间加中画线,单词首字母变小写。比如TestFormAction类对应的Action名为test-form。

Action类的包路径转为其命名空间路径,命名空间路径转为URL路径。比如com.cjm.action.card.sim.SimCardInputAction,则其命名空间为/card/sim,Action名为sim-card-input。

Action类的包路径转为结果页面的存储目录,查找结果页面的约定:
            找action名-result名.jsp,找不到
            找action名.jsp,找不到
            找action名-result名.action

3、注解

1)@ResultPath:设置结果页面位于哪里,用于覆盖默认值。默认值由struts.convention.result.path常量设定。
            @ResultPath("/WEB-INF/pages")

2)@Namespace:设置action的URL路径,用于覆盖默认值
            @Namespace("/")

Struts2 Convention插件的使用的更多相关文章

  1. Struts2 Convention插件的使用(4)使用@Action注解返回json数据

    package com.hyy.action; import java.util.HashMap; import java.util.Map; import org.apache.struts2.co ...

  2. Struts2 Convention插件的使用(1)

    刚刚查阅官方文档(convention-plugin.html)并学习了Struts2的Convention插件,文章这里只作为一个笔记,建议大家去看官方文档比较清晰和全面. 需要在项目添加这些包 c ...

  3. struts2 Convention插件零配置,使用注解开发

    从struts21开始,struts2不再推荐使用codebehind作为零配置插件,而是改用Convention插件来支持零配置.与以前相比较,Convention插件更彻底. 使用Conventi ...

  4. struts2 Convention插件好处及使用

    现在JAVA开发都流行SSH.而很大部分公司也使用了struts2进行开发..因为struts2提供了很多插件和标签方便使用..在之前开发过程中总发现使用了struts2会出现很多相应的配合文件.如果 ...

  5. struts2 convention插件

    1.struts2自2.1以后推荐使用Convention Plugin支持struts零配置支持(引入jar:struts2-convention-plugin-2.x.x.jar)①convent ...

  6. Struts2 Convention插件的使用(3)方法前的@Action注解

    package com.hyy.action; import org.apache.struts2.convention.annotation.Action; import com.opensymph ...

  7. Struts2 convention插件试用+ Spring+Hibernate SSH整合

    第一步,引入struts2-convention-plugin-2.2.1.jar 然后,改动配置文件. 我是在struts.properties文件里改动的: struts.objectFactor ...

  8. Struts2 Convention插件的使用(2)return视图以及jsp的关系

    package com.hyy.action; import com.opensymphony.xwork2.ActionSupport; public class HelloWorld extend ...

  9. struts2基于Convention插件的约定映射使用

    一.首先说明一点:所谓的基于Convention插件的约定优于配置的使用,并不是严格意义上的零配置,struts.xml文件并不能完全舍弃. 获得Convention插件功能,所必需的jar包有:|a ...

随机推荐

  1. MyEclipse中防止代码格式化时出现换行的情况的设置

    编辑完成代码,用MyEclipse的代码格式化后,本来不长的代码也被自动转成了多行.虽然自动换行以后在编辑器中一眼就能看到全部的代码,但是可读性却大打折扣,避免出现这种情况的办法是: 1.Java代码 ...

  2. VS2012变化的快捷键:

    VS2012变化的快捷键: 注释::VS2010是(Ctrl+E,C),VS2012是(Ctrl+K, Ctrl+C),实际操作,按住Ctrl键不放,先按K键,再按C键.相当于Ctrl+K加 Ctrl ...

  3. 实现ajax

    啊打发 <script type="text/javascript" src="js/jquery-1.8.3.min.js"></scrip ...

  4. 繁华模拟赛 Evensgn玩序列

    #include<iostream> #include<cstdio> #include<string> #include<cstring> #incl ...

  5. jvm内存模型和内存分配

    1.什么是jvm? (1)jvm是一种用于计算设备的规范,它是一个虚构出来的机器,是通过在实际的计算机上仿真模拟各种功能实现的. (2)jvm包含一套字节码指令集,一组寄存器,一个栈,一个垃圾回收堆和 ...

  6. axis2 webservice 发布、调用与项目集成

    发布 1.在apache官网下载axis2包,下载Binary Distribution和War Distribution两个zip. 2.将war放入tomcat webapps下部署.并输入 ht ...

  7. ssh和mvc理论基础

    ssh中mvc到底指的什么 mvcsshhibernatespringstrutsioc在SSH整合的架构中,Spring充当了一个容器的作用,Spring使用IOC和AOP技术接管了Hibernat ...

  8. 删除右键ATI CATALYST(R) Control Center的方法

    http://share.weiyun.com/c47530d3e44ea15b606d4ba6f1b00a28

  9. Coursera台大机器学习技法课程笔记01-linear hard SVM

    极其淡腾的一学期终于过去了,暑假打算学下台大的这门机器学习技法. 第一课是对SVM的介绍,虽然之前也学过,但听了一次感觉还是很有收获的.这位博主总结了个大概,具体细节还是 要听课:http://www ...

  10. Struts.xml讲解

    解决在断网环境下,配置文件无提示的问题我们可以看到Struts.xml在断网的情况下,前面有一个叹号,这时,我们按alt+/ 没有提示,这是因为” http://struts.apache.org/d ...