Do you want bean:message to be able to get the key from a bean method? It
doesn't do that now...
Since <bean:write> is printing the value of a bean property, your bean
property could use the MessageResources class to do the internationalization
in your bean method.
Inside an action you can get the MessageResource object and the Locale
object by calling these methods from the base Action class:
Locale locale = getLocale(request);
MessageResources messages = getResources();
messages.getMessage(locale,"some.key",args));
where args is an optional String array.
I am not sure how easy it would be for you to pass the messages and locale
objects into your bean and use them there.
Hal
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Friday, May 11, 2001 2:37 PM
> To: [EMAIL PROTECTED]
> Subject: RE: Checkbox Arrays - Internationalising them?!
>
>
>
>
> Hal,
>
> thanks for your input on multi-box - they are working great!
>
> BUT...I need to get the bean:write internationalized - does
> anyone know if this
> is possible?
>
> ie I want to do a bean:message on the output from a bean:write...
>
> I think this qu has been asked before, but I looked through
> the archives and
> couldn't find it...
>
> Thanks,
>
> Dave
>
>
>
>
>
> "Deadman, Hal" <[EMAIL PROTECTED]>
> on 05/10/2001
> 12:20:58 PM
>
> Please respond to [EMAIL PROTECTED]
>
> To: [EMAIL PROTECTED]
> cc: (bcc: David Hay/Lex/Lexmark)
> Subject: RE: Checkbox Arrays
>
>
>
> I posted this same response to your Posting Collections
> question yesterday.
> Here it is again. If you use the html:multibox, you can get
> back an array of
> key values instead of an array of booleans. They key values
> can be Longs,
> Strings, whatever, as long as it uniquely identifies the row
> that you want
> to know was checked. If you haven't used multibox, it
> generates an html
> checkbox. The array that will be set in your form will only
> contain the key
> values for the rows that were checked.
>
> Here is the post from yesterday:
>
> I think I am doing the same thing that you want to do using the
> html:multibox. When the form is submitted you get an array of
> the ids that
> are checked and then you can go delete them.
>
> in the jsp form (where restaurant id is a key for the item
> being deleted):
> <logic:iterate id="restaurant" name="favoriterestaurants">
> ...
> <html:multibox property="favoriteRestaurantRemoveList">
> <bean:write property="restaurantId" name="restaurant"/>
> </html:multibox>
> ...
> </logic:iterate>
>
>
> in the form class:
> private Long favoriteRestaurantRemoveList[] = new Long[0];
>
> public Long[] getFavoriteRestaurantRemoveList() {
> return (this.favoriteRestaurantRemoveList);
> }
>
> public void setFavoriteRestaurantRemoveList(Long
> favoriteRestaurantRemoveList[]) {
> this.favoriteRestaurantRemoveList =
> favoriteRestaurantRemoveList;
> }
>
> I am not sure if initializing the array to new Long[0] is necessary,
> probably not.
>
> > -----Original Message-----
> > From: Tony Karas [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, May 10, 2001 11:52 AM
> > To: Struts User
> > Subject: Checkbox Arrays
> >
> >
> > Can anyone help with this?
> >
> > I have an array of checkboxes in my ActionForm represented by
> >
> > boolean[] delete;
> >
> > and I have a setter function
> >
> > public void setDelete( boolean[] values )
> > {
> > delete = values;
> > }
> >
> > The problem is that I have only checkboxes that are checked
> > get sent back -
> > so if one checkbox is checked all I get is an array of length
> > 1. Therefore,
> > it is not possible for me to determine which checkbox has
> > been checked.
> >
> > In the documentation it tells me to use reset() in ActionForm
> > to initialise
> > the values - but this will only work with single checkboxes
> > and not arrays.
> >
> > I think I'm stuck. Is there anyway I can determine which
> > checkbox has been
> > checked - maybe I can get the value to differ for each
> > checkbox. Will look
> > in to that.
> >
> > Cheers
> > Tony
> >
>
>
>
>
>
>