• Struts2 Convention插件的使用


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

    1、常量说明

          

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

  • 相关阅读:
    加入收藏
    c#在窗口标题栏上加按钮转载自:http://tech.ddvip.com/200810/122483002782273.html
    关于获取c# 的winform中DataGird控件选中行的值
    GridView中使用LinkButton添加启用禁用功能
    winfrom定制窗体样式
    C#读取xml文件
    C#winform程序如何与js交互
    ASP.NET不允许输入空格
    Winform TextBox中只能输入数字的几种常用方法(C#)
    winfrom中的webbrowser与web里面的html以及js的交互
  • 原文地址:https://www.cnblogs.com/x_wukong/p/3916776.html
Copyright © 2020-2023  润新知