访问Action.不能跳转到指定的jsp页面,有如下异常
java.lang.NoSuchMethodException: ch7.example6.TestJaserReport.getTtt.jsp()
java.lang.Class.getMethod(Class.java:1605)
ch7.example1.DebugResult.execute(DebugResult.java:23)
com.opensymphony.xwork.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:311)
com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:206)
很奇怪,怎么会有getTtt.jsp()这么诡异的方法
突然想起我在xwork.xml中有一个自定义的result type,并把default设置成了true
<result-types>
<result-type name="debug" class="ch7.example1.DebugResult" default="true"/>
</result-types>
难怪,原本默认的result="dispatcher"现在变成了debug这个自定义的类,DebugResult的代码如下:






















其中是要指定一个 public static final String DEFAULT_PARAM="property";的,而我现在用的action配置中并没有这个参数,而且我也没有指定result="debug" 所以,webwork把我的action跳转成debug类型的result,但并没有找到他需要的property,当然就报错了,webwork把我的jsp文件--/ch7/ttt.jsp当成参数,传到DebugResult中去解析了,所以会出现找不到getTtt.jsp()这种错误
解决:把default="true"去掉就好了