自定义一个action继承dispathaction在struts-config.xml配置好 了,在表单提交的时,在地址栏上直接输入htt://localhost:8090/test/useraction.do程序报错,怎么解决
正确的应该是htt://localhost:8090/test/useraction.do?operate=login

解决方案 »

  1.   

    覆盖如下方法
    @Override
    protected ActionForward unspecified(ActionMapping mapping, ActionForm form,   HttpServletRequest request, HttpServletResponse response) throws Exception {
    }
      

  2.   

    当然错了。。diapatchaction需要制定一个参数的。没有参数的话它不知道执行哪个方法。。
    你在struts那里加个parameter,然后跳转的时候给这个parameter上个值。。
      

  3.   

    在 struts-config.xml中的action配置中定义 parameter="method"在提交表单的时候htt://localhost:8090/test/useraction.do?operate=login
    或者写个隐藏域
    <input type="hidden" name="method" value="login"/>
      

  4.   

    谢谢,我解决了,dispathAction会调用这个方法的