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
> 
> 
> ---------------------------------------------------------------------
> 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]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to