Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Struts Action Mapping displays blank page

843838Sep 29 2006 — edited Oct 3 2006
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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 31 2006
Added on Sep 29 2006
7 comments
382 views