DMI方式配置xml有两种形式:
1.使用 "!"方式,即 action名称 ! 方法名称
/WEB-INF/jsp/aggression/aggressionReport_main.jsp aggression /
2. 使用通配符方式 *,(有人建议用这种方式)
/resource/{1}_{2}Success.jsp
需要注意的是,
1. 如果在web.xml 是这样配置的
struts2 *.action
在页面上写链接的时候要写成: http://localhost:8080/ALEConsole/aggression!update .action 或者是
http://localhost:8080/ALEConsole/aggression_update.action
而不要写成:http://localhost:8080/ALEConsole/aggression.action_update,因为.action是后缀。
2. 新版的Struts2(具体从哪个版本起忘了),默认关闭DMI功能。需要在struts.xml 中打开:
<constant name="struts.enable.DynamicMethodInvocation" value="true"/>
有一个问题就是:使用DMI方式配置,如果出现action之间的跳转的该怎么写,还请各位指点!