We do this exact thing. In the Action that leads to the display of the jsp with the 
multibox we use
the code below. Given an object (created from the database) that has an ArrayList of 
the ids the
user previously selected:

       ArrayList list = (ArrayList)obj.getCheckedIssueIDList();
        if ( list != null)
        {
         int size = list.size();
         String[] issueCheckbox = new String[size];
         for (int i=0; i < size; i++)
         {
          issueCheckbox[i] = (String)list.get(i);
         }
         localForm.setIssueCheckbox(issueCheckbox);
        }

In the localForm we have the following methods:
public String[] getIssueCheckbox()
    {
        return this.checkbox;
    }

  public void setIssueCheckbox(String[] stArray)
    {
        this.checkbox = stArray;
    }

----- Original Message -----
From: "Firmin David" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, March 21, 2001 3:30 AM
Subject: REPOST: Prechecking with <html:multibox>


> Sorry, I still can't get around this, can anyone help?
>
> I've seen it in action in the test app, I've read the documentation, but I
> still can't precheck with <html:multibox>.
>
> I have a list of checkboxes generated *dynamically* from DB records by the
> <logic:iterate> & <html:multibox> tags. The user defines their own subset of
> these checkboxes by checking them on the screen. Their DB record is then
> updated accordingly when the form is submitted. When the user views their
> subset at a later date, the boxes they've chosen need to appear prechecked
> in the list.
> The value of the checkbox has to be the DB identity as I'd need to work out
> which were selected/deselected, so it can't correspond to the list as
> defined by the user(?) so how can I work out with html:multibox which of the
> boxes the user selected?
> (Would be easy with an if(item.isChecked) scriptlet, but sadly, this will
> not parse within the multibox tag)
>
> At the moment I have this (within iterate):
> <html:multibox property="item_ids" value="<%=item.getId()%>"/>
> where item_ids is a collection of all possible box ids returned from the DB.
> This gives me my list with all the correct Ids behind all the correct
> checkboxes, but I can't figure out how to incorporate the user's selection
> and precheck them...
>
> Any advice would be greatly appreciated.
>
> Thanks in advance
>
> Rgds
>
> David
>
>
>
> ************************************************************************
> The information in this email is confidential and is intended solely
> for the addressee(s).
> Access to this email by anyone else is unauthorised. If you are not
> an intended recipient, you must not read, use or disseminate the
> information contained in the email.
> Any views expressed in this message are those of the individual sender,
> except where the sender specifically states them to be the views of
> The Capital Markets Company.
>
> http://www.capco.com
> ***********************************************************************
>

Reply via email to