Absolutely! Large open-source projects...unbeatable!! Viva la revolucion! -----Original Message----- From: Kris Schneider [mailto:[EMAIL PROTECTED] Sent: 02 July 2003 14:23 To: Struts Users Mailing List Subject: RE: <html:errors/> problems
;-) Glad it helped. Nothing like having billions and billions of other developers eyeballing your code... Quoting Brian McSweeney <[EMAIL PROTECTED]>: > Reasons why people should love this list: > > 1) People solve bugs for you that you didn't even know you had! > > Thanks SO much Kris, > I turned off javascript, and yes, I was ignoring the other validation > errors. Your code made it work perfectly. > I really appreciate your help, > Brian > > > > -----Original Message----- > From: Kris Schneider [mailto:[EMAIL PROTECTED] > Sent: 02 July 2003 12:38 > To: Struts Users Mailing List > Subject: RE: <html:errors/> problems > > Brian, > > Now that the messages are working, one other thing you might want to > check is > whether your validator-based validation errors are really being > captured. The > first few lines of your validate method look like they just ignore the > result of > calling super.validate: > > public ActionErrors validate( ActionMapping mapping, > HttpServletRequest request ) { > // this should call the validate on the automatic stuff > super.validate( mapping, request ); > ActionErrors errors = new ActionErrors( ); > ... > return errors; > } > > You probably want something more like: > > public ActionErrors validate( ActionMapping mapping, > HttpServletRequest request ) { > // this should call the validate on the automatic stuff > ActionErrors errors = super.validate( mapping, request ); > if (errors == null) { > errors = new ActionErrors( ); > } > ... > return errors; > } > > Quoting Brian McSweeney <[EMAIL PROTECTED]>: > > > IV, > > > > >You want to have the message key in your ActionError and struts will > > >resolve it from the ApplicationResources file for you. It is not > > something >you manually need to do. > > > > That was the problem! Thanks so much! I didn't have the message in my > > Resource bundle. Once I put it in, everything worked fine. > > I really appreciate your help! > > Brian > > > > > > -----Original Message----- > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > > Sent: 02 July 2003 11:26 > > To: [EMAIL PROTECTED] > > Subject: RE: <html:errors/> problems > > > > > > Brian, > > > > You want to have the message key in your ActionError and struts will > > resolve it from the ApplicationResources file for you. It is not > > something you manually need to do. > > > > However last time I tried to return a value which was not in the > > ApplicationResources file I got an exception thrown stating that it > does > > not exist. Returning blank sounds strange to me. Do you have a stack > > trace saying that your message is not in this file? > > > > Regards > > IV > > > > > > > > > from: Brian McSweeney <[EMAIL PROTECTED]> > > > date: Wed, 02 Jul 2003 11:13:54 > > > to: [EMAIL PROTECTED] > > > subject: RE: <html:errors/> problems > > > > > > Hi IV, > > > Thanks for the help. I gave that a go, > > > Putting the error.stuff into my resource bundle. > > > I am now getting back the bullet points for each > > > Error but still cannot see the messages at all! > > > > > > This seems nuts to me, if I look at the ActionError > > > constructor, it takes a string as it's parameter which > > > I presume is what it displays! > > > > > > So my jsp is getting the ActionError (because it outputs > > > a bullet for the bullet list). However, it just can't seem > > > to display the string! > > > > > > Any other ideas? > > > Thanks, > > > Brian > > > > > > -----Original Message----- > > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > > > Sent: 02 July 2003 10:40 > > > To: [EMAIL PROTECTED] > > > Subject: Re: <html:errors/> problems > > > > > > > > > Hi Brian, > > > > > > I had a problem like that when I ommited the following values from > my > > > ApplicationResources file: > > > > > > errors.header = <ul> > > > errors.footer = </ul> > > > errors.prefix = <li> > > > errors.suffix = > > > > > > Once I added them it worked fine. > > > > > > Regards > > > IV > > > > > > > > > > from: Brian McSweeney <[EMAIL PROTECTED]> > > > > date: Wed, 02 Jul 2003 10:28:03 > > > > to: [EMAIL PROTECTED] > > > > subject: Re: <html:errors/> problems > > > > > > > > Hi all, > > > > > > > > I'm trying to display errors on a jsp to which my form returns if > > the > > > > data submitted is invalid. > > > > > > > > My form extends org.apache.struts.validator.ValidatorForm > > > > > > > > some fields use the validator form validation, but for custom > server > > > > side validation I overwrite the > > > > validate method as follows: > > > > > > > > public ActionErrors validate( ActionMapping mapping, > > > > HttpServletRequest request ) { > > > > // this should call the validate on the automatic stuff > > > > super.validate( mapping, request ); > > > > ActionErrors errors = new ActionErrors( ); > > > > > > > > customCheck1( getFormField1(), > "messagebundle.customError1", > > > > errors ); > > > > customCheck2( getFormField2(), > "messagebundle.customError2", > > > > errors ); > > > > > > > > return errors; > > > > } > > > > > > > > then in the same class I have my custom methods, eg: > > > > > > > > private void customCheck1( String value, String msg, > ActionErrors > > > > errors ) { > > > > if ( value.equalsIgnoreCase("whatever") { > > > > String message = ResourceBundle.getBundle( "mybundle" > > > > ).getString( key ) > > > > errors.add( ActionErrors.GLOBAL_ERROR , new > ActionError( > > > > message ) ); > > > > } > > > > } > > > > > > > > > > > > Now, I know this is getting called, due to debug that I have > > included. > > > > > > > I'm successfully getting all the error messages from the resource > > > bundle > > > > etc. > > > > In my jsp I have the following tag to try to output the > ActionError > > > > messages > > > > > > > > <html:errors/> > > > > > > > > What's happening is, my jsp is being validated, but the messages > > just > > > > aren't > > > > getting outputted. I'm getting white space where the messages > should > > > be, > > > > > > > > and when I look at the source I see that > > > > <br> lines are being created for (what I assume is) each > > ActionError. > > > > > > > > If anyone can give me advice/help, I'd really appreciate it. > > > > thanks, > > > > Brian > > -- > Kris Schneider <mailto:[EMAIL PROTECTED]> > D.O.Tech <http://www.dotech.com/> -- Kris Schneider <mailto:[EMAIL PROTECTED]> D.O.Tech <http://www.dotech.com/> --------------------------------------------------------------------- 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]