在使用DMI(动态方法调用)的时候要注意struts.xml配置时要把
不然会出现错误
完整示例代码
struts.xml
/MyPath.jsp /MyPath.jsp /hello.jsp /index.jsp
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
struts2 org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter struts2 /*