struts2 convention插件配置说明

struts2开发了convention插件来支持零配置文件的功能,以下是struts2 convention中的配置属性说明:

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、注解

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

 

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

      3)@Action 用来标识struts2 action方法

           @Action(value="",results={@Result(name="",location="")})

           其中,value为标识该action的名称,result为action返回后,结果的名称和定向路径。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值