struts2动态结果集java.lang.NoSuchMethodException

来源:百度知道 编辑:UC知道 时间:2024/06/14 16:06:10
动态结果集找不到方法,高手帮忙看下,谢谢了。不是太重要的知识,但是个心病。
Action:
import com.opensymphony.xwork2.ActionSupport;
public class DynamicAction extends ActionSupport {
private String r;
private int type;
public String action()throws Exception{
if (type==1) r="/success.jsp";
else if (type==2)
r="/failed.jsp";
else
System.out.println(type);
return SUCCESS;
}
public void setR(String r){
this.r=r;
}
public void setType(int type){
this.type=type;
}
public String getR(){
return r;
}
public int getType(){
return type;
}
}
配置文件:
<package name="" namespace="/" extends="struts-default">
<action name="action" class="DynamicAction" >
<result name="success">${r}</result>
</action>
</package>
我直接用http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.devMode" value="true"></constant>
<constant name="struts.enable.DynamicMethodInvocation" value="true" />
<package name="" namespace="/" extends="struts-default">
<action name="action" class="DynamicAction">
<result name="success">${r}</result>
</action>
</package>

</struts>