I have seen cases of a blank JSP when I am forwarding to an invalid or unknown page.
[EMAIL PROTECTED] wrote:
Thanks for your help, Frank. I tried changing my code to match yours and
unfortunately got the same results...a blank (empty) jsp page. It is so
weird that it works in my LogonAction class but not the ActionForm.
I have used the ActionErrors class a hundred times in ActionForms and this
one is no different that any other. I have a feeling that something is wrong
in the web.xml since my code looks right.
-Lynne
-----Original Message----- From: Frank Zammetti [mailto:[EMAIL PROTECTED] Sent: Monday, June 21, 2004 9:44 AM To: [EMAIL PROTECTED] Subject: RE: ActionForm returning blank jsp
Sorry, I didn't see that tag.
Hmm, I'm not sure then. One thing I notice is that the code in your ActionForm adding the errors looks a little different than what I have, not sure it would matter though. Here's what I have:
errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionError("messages.userIDBlank", "UserID"));
Frank
From: [EMAIL PROTECTED] Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Subject: RE: ActionForm returning blank jsp Date: Mon, 21 Jun 2004 09:34:04 -0500
Yes, it is literally returning a blank document. The errors should be displayed in the jsp using the <html:errors/> tag.
-----Original Message----- From: Frank Zammetti [mailto:[EMAIL PROTECTED] Sent: Monday, June 21, 2004 9:30 AM To: [EMAIL PROTECTED] Subject: RE: ActionForm returning blank jsp
When you say the JSP is blank, do you mean you are literally getting a blank
document back, or do you simply mean the errors are not being displayed? If
the later, I don't see anywhere that you are displaying the errors. Trying adding the following before your form:
<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]
--------------------------------------------------------------------- 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]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]