struts2 DMI
在使用DMI(动态方法调用)的时候要注意struts.xml配置时要把
<constant name="struts.enable.DynamicMethodInvocation" value="true"/>
不然会出现错误

完整示例代码
struts.xml
<constant name="struts.devMode" value="true" />
<constant name="struts.enable.DynamicMethodInvocation" value="true"/>
<package name="default" namespace="/path" extends="struts-default"> <action name="path" class="com.pengli.structs2.actionstudy.IndexAction3">
<result name ="a">
/MyPath.jsp
</result>
</action>
</package>
<package name="default2" namespace="/" extends="struts-default">
<action name="path2" class="com.pengli.structs2.actionstudy.IndexAction3">
<result name ="a">
/MyPath.jsp
</result>
<result name ="add">
/hello.jsp
</result>
<result name ="edit">
/index.jsp
</result>
</action>
</package>
IndexAction3
package com.pengli.structs2.actionstudy;
import com.opensymphony.xwork2.ActionSupport;
public class IndexAction3 extends ActionSupport{
@Override
public String execute() throws Exception {
// TODO Auto-generated method stub
return "a";
} public String add()
{
return "add";
} public String edit()
{
return "edit";
}
}
web.xml
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
struts2 DMI的更多相关文章
- Struts2 DMI的使用
Struts2的Action类中可以放置多个方法并在struts.xml中配置供页面调用.只要方法符合execute()方法的标准即返回类型是String就可以了. 同一个Action多个方法调用的方 ...
- struts2 DMI问题
最新开始学习struts2,在官网上下载的最新的struts2(2.3.15.2), jar包,在使用动态方法调用的时候老是报错,错误代码如下HTTP Status 404 - There is no ...
- struts2 s2-032漏洞分析
0x01Brief Description 最近面试几家公司,很多都问到了s2漏洞的原理,之前调试分析过java反序列化的漏洞,觉得s2漏洞应该不会太难,今天就分析了一下,然后发现其实漏洞的原理不难, ...
- ref:Struts2 命令执行系列回顾
ref:http://www.zerokeeper.com/vul-analysis/struts2-command-execution-series-review.html Struts2 命令执行 ...
- struts2 CVE-2012-0392 S2-008 Strict DMI does not work correctly allows remote command execution and arbitrary file overwrite
catalog . Description . Effected Scope . Exploit Analysis . Principle Of Vulnerability . Patch Fix 1 ...
- Struts2的DMI跟SMI
我使用的Struts2的版本是2.5.2,今天在使用Struts2的DMI(动态方法调用)的时候出现了一个有趣的问题,我先把我的配置及代码展示一下: web.xml <filter> &l ...
- struts2的动态方法调用(DMI)和通配符映射
动态方法调用 1.Struts2默认关闭DMI功能,需要使用需要手动打开,配置常量 struts.enable.DynamicMethodInvocation = true 2.使用“!”方法,即 ...
- struts2 中使用DMI(动态调用方法)方式配置action
1.使用 "!"方式,即 action名称 ! 方法名称 struts.xml 配置 <package name="user" namespace=&qu ...
- Struts2动态方法调用(DMI)
当structs.xml解析到Action的时候,默认执行的是此action的execute()方法,但是实际开发中,我们的action中含有很多方法,比如说增删改查的方法,那么structs.xml ...
随机推荐
- 熟练掌握js中this的用法,解析this在不同应用场景的作用
由于其运行期绑定的特性,JavaScript 中的 this 含义要丰富得多,它可以是全局对象.当前对象或者任意对象,这完全取决于函数的调用方式. JavaScript 中函数的调用有以下几种方式:作 ...
- JavaSpring
http://www.cnblogs.com/suoning/p/5656403.html 1.序列化 JSON.stringify(obj) 序列化 JSON.parse(str) ...
- Mongodb Manual阅读笔记:CH7 索引
7索引 Mongodb Manual阅读笔记:CH2 Mongodb CRUD 操作Mongodb Manual阅读笔记:CH3 数据模型(Data Models)Mongodb Manual阅读笔记 ...
- linux的“自动化”
h2:first-child, body>h1:first-child, body>h1:first-child+h2, body>h3:first-child, body>h ...
- python爬取并下载麦子学院所有视频教程
一.主要思路 scrapy爬取是有课程地址及名称 使用multiprocessing进行下载 就是为了爬点视频,所以是简单的代码堆砌 想而未实行,进行共享的方式 二.文件说明 itemsscray字段 ...
- A cost-effective recommender system for taxi drivers
一个针对出租车司机有效花费的推荐系统 摘要 GPS技术和新形式的城市地理学改变了手机服务的形式.比如说,丰富的出租车GPS轨迹使得出做租车领域有新方法.事实上,最近很多工作是在使用出租车GPS轨迹数据 ...
- [转]输出带颜色的shell
格式: echo -e "\033[字背景颜色;字体颜色m字符串\033[0m" 例如: echo -e "\033[41;36m something here \033 ...
- java汉化
http://download.eclipse.org/technology/babel/babel_language_packs/R0.13.0/luna/luna.php _x86_64版本下载地 ...
- php 批量更新某字段内容的部分内容 replace(要替换的字段,'被替换的字符串,'替换成的字符串')
要求: 一个字段值: ------预约---- 要将其中 "预约",改成"预定". 但是我开始写的时候,写成了 update 表名 set smscontent ...
- MMORPG大型游戏设计与开发(客户端架构 part2 of vegine)
一个好的接口是尽可能让更多实用的方法进行整理封装,要记住的是不常用的方法和类最好不好封装到接口中,因为那样会造成本身的困惑.基础模块中并没有太多封装,甚至连一个类的封装也没有,而是一些很常用的工具方法 ...