出现DispatchMapping does not define a handler property异常
在struts
出现DispatchMapping does not define a handler property异常
在struts
DispatchMapping does not define a handler property这个问题的产生是因为Action中的方法出问题了。
如果是就一个excute方法,那么注意这个方法得方法名,参数等(4个参数),如果是多方法,注意这个默认的方法是否存在,在struts-config中需要配置parameter参数。
如果多方法就将excute方法去掉,然后在struts-config中需要配置parameter参数;[color=red](因为有excute方法程序就默认调用excute方法)[/color]
例如action中有保存操作和更新操作的方法:
public class TestAction extends DispatchAction {
public ActionForward doSave(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
return null;
}
public ActionForward doUpdate(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
return null;
}
}
在struts-config.xml中配置如下:
scope="request"
type="org.springframework.web.struts.DelegatingActionProxy" />
在applicationContext.xml中配置如下:
注意红色部份,在页面调用时../actions/testAction.do?act=doSave。这样就可以调用TestAction中的doSave方法,我举这个例子是在ssh取出来的,只作解释参考。