On Thu, 21 Jun 2001, Becky Moyer wrote:

> Steve,
>    Thanks so much for your reply, it gave me some more leads to follow.  I
> have been playing with this for the last 2 days...I have tried to change my
> webapp to be similar to yours.

That could get ugly. =:]

>  I made my form have 2 string arrays, but
> when I try to iterate over my form as you have done in the example you gave,
> I either had to iterate over one string array or the other, and when I tried
> to specify the property in the multibox tag, it couldn't find the getter...I
> am assuming that, in step with the example you gave, Struts is trying to do
> a advancedQueryForm.getFindAssets().getSelectedAssets() for the multibox,
> when I think you are saying it should be doing an
> advancedQueryForm.getSelectedAssets().
>    I am still plodding along, but haven't made much progress.  Is there
> something I'm missing?
>    Thanks,
>    Becky

 It sounds like you are getting close to what I'm using. I'm only
iterating over the String[] that contains all the possible values.
Values in the other String[] that match the array you are iterating
over will cause the checkboxes to be set to checked (but you don't need
to iterate over this second String[]). Also make sure the array you are
iterating over always contains all of the possible attributes, either by
saving it in session scope or repopulating it each time in request scope
(i.e., don't set it to null in reset()). In the ActionForm, I have:


    private String[] findAssets = null;
    private String[] selectedAssets = null;

/**
 * Get
 */
    public String[] getFindAssets() {
      return (this.findAssets);
    }
/**
 * Set
 *
 * @param
 */
    public void setFindAssets(String[] findAssets) {
      this.findAssets = findAssets;
    }


/**
 * Get
 */
    public String[] getSelectedAssets() {
      return (this.selectedAssets);
    }
/**
 * Set
 *
 * @param
 */
    public void setSelectedAssets(String[] selectedAssets) {
      this.selectedAssets = selectedAssets;
    }


Reply via email to