转自: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. PHP 与网址相关内容

    在PHP中,有时需要知道脚本所处的位置,这时会用到$_SERVER['SCRIPT_NAME'].$_SERVER['SCRIPT_FILENAME']及__FILE__.那么他们之间有什么不同呢? ...

  2. OpenXML_导入Excel到数据库(转)

    (1).实现功能:通过前台选择.xlsx文件的Excel,将其文件转化为DataTable和List集合 (2).开发环境:Window7旗舰版+vs2013+Mvc4.0 (2).在使用中需要用到的 ...

  3. PHP正则表达式基础入门

    思维导图 介绍 正则表达式,大家在开发中应该是经常用到,现在很多开发语言都有正则表达式的应用,比如JavaScript.Java..Net.PHP 等,我今天就把我对正则表达式的理解跟大家唠唠,不当之 ...

  4. tyvj3481 越狱

    描述 监狱有连续编号为1...N的N个房间,每个房间关押一个犯人,有M种宗教,每个犯人可能信仰其中一种.如果相信房间的犯人的宗教相同,就可能发生越狱,求有多少种状态可能发生越狱 输入格式 输入两个整数 ...

  5. zabbix再爆高危SQL注入漏洞,可获系统权限

    漏洞概述 zabbix是一个开源的企业级性能监控解决方案.近日,zabbix的jsrpc的profileIdx2参数存在insert方式的SQL注入漏洞,攻击者无需授权登陆即可登陆zabbix管理系统 ...

  6. xcode注释

    新开的项目需要先开发iOS版本,所以又把好久没写的iOS捡起来了,之前都是手动注释,最近是越来越懒了,所以在网上找了一个自动注释的插件,啊哈,其实有时候还真的挺怀念用Eclipse的时候,不过不用羡慕 ...

  7. UINavigation拖动翻页

    #import <UIKit/UIKit.h> #import "ViewController.h" //window窗口 #define WINDOW [[UIApp ...

  8. glut64位操作系统安装

    64位win7下OpenGL的配置 - walkandthink的专栏 - 博客频道 - CSDN.NEThttp://blog.csdn.net/walkandthink/article/detai ...

  9. Bellman-Ford算法

    #include<stdio.h> #define max 0xffffff ][]; //图的邻接矩阵 ]; int n;//顶点个数 int m;//边个数 struct Edge { ...

  10. PHP 遍历数组的方法汇总

    1. foreach() foreach()是一个用来遍历数组中数据的最简单有效的方法. #example1: <?php $colors= array('red','blue','green' ...