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
<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
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);
}
}