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
>






Reply via email to