<logic:messagesPresent> <font color="#ff0000"> <html:messages id="error"> <li><bean:write name="error"/></li> </html:messages> </font> <br><br> </logic:messagesPresent>
From: [EMAIL PROTECTED] Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Subject: ActionForm returning blank jsp Date: Mon, 21 Jun 2004 09:20:02 -0500
I am having a problem with my ActionForm validate() method returning a blank
jsp page.
It is a very simple logon.jsp with only two required fields "username" and
"Password" The ActionForm validates that the user has in fact entered
something in both fields. If the user has left a field blank, the ActionForm
should return an error, "please enter a username", etc. All validation after
that is performed in the logonAction execute() such as "user not found in
system", "invalid username, password" etc. The LogonAction execute() returns
errors to the logon.jsp as it should. My logonForm however, does not, just a
blank (empty) jsp page. Any suggestions would be greatly appreciated.
Here is my JSP
<%@ page contentType="text/html;charset=iso-8859-1" language="java" %> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<html:form action="/Logon" name="logonForm" type="biz.books.logon.LogonForm"> <BODY bgcolor="#FFFFFF" leftMargin=0 topMargin=0 marginwidth="0" marginheight="0" class=bg> <table width="750" border="0"> <tr> <td width="169"><html:errors/></td> <td width="524"> </td> <td width="43"> </td> </tr> <tr> <td><div align="right" class="style2">username:</div></td> <td><html:text property="username" size="30"/> </td> <td> </td> </tr> <tr> <td><div align="right" class="style2">password:</div></td> <td><html:password property="password" size="30"/> </td> <td> </td> </tr> <tr> <td> </td> <td><html:submit/></td> <td> </td> </tr> </table> </BODY> </html:form>
My STRUTS-CONFIG
<form-bean name="logonForm" type="biz.books.logon.LogonForm"> </form-bean>
<action path="/Logon" type="biz.books.logon.LogonAction" name="logonForm" scope="request" validate="true" input="/logon.jsp"> <forward name="fail" path="/logon.jsp" /> <forward name="success" path="/userhome.page" /> </action>
My ActionForm
/** * Form bean for the user signon page. */ public class LogonForm extends ActionForm {
private String password; private String username;
public LogonForm(){ password = ""; username = ""; }
//getters and setters are here
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = new ActionErrors();
if ((username == null) || (username.length() < 1)) errors.add("username", new ActionError("error.noUsername"));
if ((password == null) || (password.length() < 1)) errors.add("password", new ActionError("error.noPassword"));
return errors; }
Thanks in advance! -Lynne
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
_________________________________________________________________
From ‘will you?’ to ‘I do,’ MSN Life Events is your resource for Getting
Married. http://lifeevents.msn.com/category.aspx?cid=married
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]