Your comment about the apostrophe is a clue - it's a special character in the MessageFormat class that's used for quoting. Use two apostrophes to display '. I think you'll find {0} will then be evaluated.

And relax - Jeff's response may have been no help to you, but he was trying.
And please turn off your request for return receipts.


Paul

w i l l i a m b o y d wrote:

hello all,

developing on w98 with tomcat 3.2.24, mysql 3.23.36, struts 1.0.2, jdk
1.3.1., servlet 2.2. will be deploying on basically similar setup; but
deployment os is xp.

i got a jsp page that has a choice box that allows multiple choices. i set a
validation rule in my action form's validate method, that disallows users
from selecting more options than permitted by my limit. if a user goes over
the limit the form doesn't get submitted. the validation rule is checked
just fine; struts creates an error for it and adds it to the errors
collection. but the error message that is displayed on the input page does
not contain the parameterized message as expected. instead, it shows the
complete, unformatted message, exactly (minus an apostrophe) as it appears
in the resource bundle! does anybody know what i'm overlooking? is this a
bug in 1.0.2?

here is what gets displayed (verbatim) on the input page after the
validation error is created:

     Sorry! Youve selected too many choices for {0}.  (what happened to my
apostrophe in "You've" ?)

here is the appropriate line from my resource bundle:

error.prefs.limit=Sorry! You've selected too many choices for {0}.

here is a snip from my form's validate method:
     ...
     ActionErrors errors = new ActionErrors();
     ...
     if ( isTooManyPrefs ) {
        ActionError prefMusicError = new ActionError( "error.prefs.limit",
"Preferred Music" );
 errors.add( "prefMusic", prefMusicError );

      }
     ...

here are the results of me looping through prefMusicError.getValues() inside
validate:

     error.prefs.limit's replacement value # 0: Preferred Music
     error.prefs.limit's replacement value # 1: null
     error.prefs.limit's replacement value # 2: null
     error.prefs.limit's replacement value # 3: null


here is a snip from the input page that generates the validation error and to which struts reports the error:

     ...
     <td><html:errors />&nbsp;</td>
     ...

what's going on here? why doesn't struts format the message to include the
replacement value. it's obviously there! at least *i* can get at it from the
object array that i get from ActionError.getValues()! please, help! thanks
in advance.

will



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