struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Friedman" <hum...@ix.netcom.com>
Subject RE: validate in ActionForm not working for errors
Date Wed, 01 Sep 2004 19:13:04 GMT
Are you sure the URL of the submit (when there are errors) isn't redirectly
somewhere?  Have you verified that the url is still /login.do when an error
is submitted in your browser's URL location bar?

Regards,
David

-----Original Message-----
From: Saurabh Bhatla [mailto:saurabh@resolution.com]
Sent: Monday, August 30, 2004 5:52 PM
To: Struts Users Mailing List
Subject: RE: validate in ActionForm not working for errors


hi Jim
  i had tried index.jsp too but it didnt work. I also tried sending it
back to another page but that didnt work either.

what should i do, i m stuck....

regards
saurabh

On Mon, 2004-08-30 at 16:47, Jim Barrows wrote:
> > -----Original Message-----
> > From: Saurabh Bhatla [mailto:saurabh@resolution.com]
> > Sent: Monday, August 30, 2004 2:41 PM
> > To: Struts Users Mailing List
> > Subject: RE: validate in ActionForm not working for errors
> >
> >
> > Hi jim
> >
> > here is the snippet from struts-config.xml
> >
> >     <action    path="/logon"
> >                type="prototype.beans.LogonAction"
> >                name="logonForm"
> >                validate="true"
> >                scope="request"
> >                input="index">
>
> 	I think this needs to be /index.jsp, not just index. Unless index is your
tiles definition... In which case try /index.jsp and see if it works.. if it
does then you mave something going on with tiles.
>
>
> >       <forward name="success" path="/main.jsp"/>
> >
> >     </action>
> >
> > and here is the snippet from LogonForm
> >
> >
> >
> >     public ActionErrors validate(ActionMapping actionMapping,
> > HttpServletRequest request)
> >     {
> > 	ActionErrors errors = new ActionErrors();
> > 	if(getName().trim().equals("") || getName()==null)
> > 	    errors.add("name",new ActionError("errors.name.required"));
> > 	if(getPassword().trim().equals("") || getPassword()==null)
> > 	    errors.add("password",new
> > ActionError("errors.passwd.required"));
> >
> > 	return errors;
> >
> >     }
> >
> > and here is relevant portion of jsp
> >
> > <html:html locale="true">
> > <head>
> > <title><bean:message key="logon.title"/></title>
> > <html:base/>
> > </head>
> > <body bgcolor="white">
> >
> > <html:errors/>
> > <div align="center">
> > <h3><bean:message key="logon.heading"/></h3>
> > </div>
> > <html:form action="/logon">
> > <table border="0" width="100%">
> >
> >   .....table information
> >
> > </table>
> >
> > </html:form>
> >
> > </body>
> > </html:html>
> >
> > regards
> > saurabh
> >
> >
> >
> > On Mon, 2004-08-30 at 16:31, Jim Barrows wrote:
> > > > -----Original Message-----
> > > > From: Saurabh Bhatla [mailto:saurabh@resolution.com]
> > > > Sent: Monday, August 30, 2004 2:29 PM
> > > > To: struts
> > > > Subject: validate in ActionForm not working for errors
> > > >
> > > >
> > > > hi all,
> > > >     I have a simple form that takes username and passwd. for
> > > > that i have
> > > > a LogonForm bean, which has a validate method. if i enter
> > > > both username
> > > > and passwd it works fine and gets forwarded to the next
> > page. but if
> > > > there is an error in validate() and ActionErrors object is
> > > > returned then
> > > > my control goes to a blank page. I know that my ActionErrors
> > > > object has
> > > > been populated as i have checked it with debug statements. 'input'
> > > > property in my action mapping is to index.jsp, that is the
> > > > page itself.
> > > > why is it showing me a blank page. why is the framework not
> > > > showing any
> > > > exception if there is one.
> > > >
> > > > any suggestions
> > >
> > > could you show us the relevant portions of your
> > struts-config.xml, index.jsp and the validate method?
> > > Given what you said it's probably a typo, or something very subtle.
> > >
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > > For additional commands, e-mail: user-help@struts.apache.org
> > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message