I have the following mapping in my struts-config file. The showLogin.do page shows the login page (which has the actual login form) and this action mapping works. Since I am using validation, it also displays required errors for username and password back on the login.do page. However when all the form fields are entered correctly it show me a blank page.
The problem is the other mapping which calls LoginAction does not work. There are no errors shown in the server logs.. I have a print statement inside the LoginAction on the very first line of the execute() method but it does not print anything. I am assuming that it does not reach LoginAction. I am not sure what I am doing wrong because I dont see any errors. Can anyone please help me?
<!-- Form Bean Definitions -->
<form-beans>
<form-bean name="loginForm" type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="userName" type="java.lang.String">
</form-property>
<form-property name="password" type="java.lang.String">
</form-property>
</form-bean>
</form-beans>
<!-- Action Mapping Definitions -->
<action-mappings>
<action path="/login" type="edu.test.action.LoginAction" name="loginForm"
scope="request" validate="true" input="/WEB-INF/jsp/login.jsp">
<forward name="success" path="/WEB-INF/jsp/login-success.jsp"></forward>
</action>
<action path="/showLogin" forward="/WEB-INF/jsp/login.jsp">
</action>
</action-mappings>
Here is my LoginAction code
public class LoginAction extends Action {
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletRequest response)
throws Exception {
System.out.println("In action");
return mapping.findForward("success");
} }
Here is my login.jsp file
<%@ taglib uri="/WEB-INF/tld/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tld/struts-bean.tld" prefix="bean" %>
<html:html><HEAD><TITLE></TITLE></HEAD><BODY>
<html:errors/>
<TABLE> <html:form action="/login" method="post">
<TR><TD>Username:</TD><TD><html:text property="userName" /></TD></TR>
<TR><TD>Password:</TD><TD><html:password property="password" ></TD>
<TR><TD>Submit</TD><TD><html:submit value="Login"/> </TD></TR>
</html:form></BODY></html:html>
Message was edited by:
keepswimming
Message was edited by:
keepswimming