[struts2应用技巧] 让action名称中支持斜杠
来源:互联网 发布:cs go mac版地图闪退 编辑:程序博客网 时间:2024/06/11 10:28
[struts2应用技巧] 让action名称中支持斜杠
在开发过程中,struts.xml的配置过于复杂重复,所以想到了用通配符"*"。而url里面包含多个层级的话,又需要分开定义不同的包。所以想能不能在action的名称中加入斜杠。在google上查了一下资料,发现可行。
http://struts.apache.org/2.1.8/docs/wildcard-mappings.html
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"><struts> <package name="ptsystem" extends="json-default" namespace="/"> <action name="view*" class="{1}Action" method="view{1}"> <result name="success">/setting/{1}List.jsp</result> </action> <action name="*/toadd*" class="{2}Action" method="add{2}"> <result name="success">{1}/{2}Add.jsp</result> </action> </package> <!-- 上传附件定义 --> <constant name="struts.multipart.parser" value="jakarta">constant</constant> <constant name="struts.i18n.encoding" value="gbk" /> <constant name="struts.enable.SlashesInActionNames" value="true"/></struts>
只需要加入一个常量定义,便可支持action名称中使用斜杠。
<constant name="struts.enable.SlashesInActionNames" value="true"/>
- [struts2应用技巧] 让action名称中支持斜杠
- struts2中Action名称的搜索顺序
- struts2中Action名称的搜索顺序
- struts2中Action名称的搜索顺序
- struts2中Action名称的搜索顺序举例说明
- 在struts2中获取请求action名称或参数
- struts2 Action 名称的搜索顺序
- Struts2 Action名称的搜索顺序
- 详解Struts2 Action名称的搜索顺序
- 详解Struts2 Action名称的搜索顺序
- Struts2之Action名称的搜索顺序
- 【struts2】Action名称的搜索顺序
- struts2 Action名称的搜索顺序
- struts2之Action名称的搜索顺序
- Struts2 Action名称的搜索顺序
- 详解Struts2 Action名称的搜索顺序
- struts2中action to action
- Struts2 Action中跳转Action
- Direct Message功能简单分析
- [Struts2应用开发] JSON的应用
- JS 判断输入框内为中文或者是英文数字
- Unity编程笔记
- linux程序shell程序后台运行
- [struts2应用技巧] 让action名称中支持斜杠
- 年月日的奥秘
- 配置仿真器
- java.lang.OutOfMemoryError: PermGen space及其解决方法 .
- Linux Shell常用技巧(七)
- ASP.NET MVC:窗体身份验证及角色权限管理示例
- 39.windbg-CPU基础(dg)
- [Struts2应用开发] struts2常量设置
- 当前流行的EE框架