错误:“不包含名为“方法"的haErndler参数.这可能是由空白“ [英] Error:"does not contain haErndler parameter named 'method'. This may be caused by whitespace "

查看:98
本文介绍了错误:“不包含名为“方法"的haErndler参数.这可能是由空白“的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道并收到此错误:对于此代码:

struts-config.xml

Hi I''m amit and getting this error: for this code:

struts-config.xml

<form-beans>
        <form-bean name="TestForm" type="TestForm"/></form-beans>


<action-mappings>
        <action input="/jsp/index.jsp" name="TestForm" parameter="test" path="/test" scope="request" type="TestDispatchAction"/>
        <forward name="pass" path="/jsp/Next.jsp"/>
        <forward name="fail" path="/jsp/index.jsp"/>
        <forward name="success" path="/jsp/welcomeStruts.jsp"/>
    </action-mappings>


index.jsp


index.jsp

<html:form action="/test.do?parameter=test">
 Name: <html:text property="textName"/><br>
 Password:   <html:password property="textPass"/><br>
 <html:submit property="loginButton" value="Login Here"/>
 <html:submit property="testButton" value="Test Only"/>
 </html:form>


TestDispatchAction


TestDispatchAction

public class TestDispatchAction extends DispatchActio
 {  private final static String SUCCESS = "success";
    public ActionForward loginAction(ActionMapping mapping, ActionForm  form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {
        TestForm f=(TestForm)form;
        String name=f.getTextName();
        String pass=f.getTextPass();
        String logic="fail";
        if(name.equals(pass))
        {
            logic="pass";
        }
        else
        {
            logic="fail";
        }
        return mapping.findForward(logic);
    }

    public ActionForward testAction(ActionMapping mapping, ActionForm  form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {
        TestForm f=(TestForm)form;

        return mapping.findForward(SUCCESS);
    }
}

推荐答案

第一件事是该类看上去很奇怪:

First thing is the class looks odd:

public class TestDispatchAction extends DispatchActio {
  [...]
}



超类应为DispatchAction.



The super class should be DispatchAction.


这篇关于错误:“不包含名为“方法"的haErndler参数.这可能是由空白“的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆