I wish I could help, but unfortunately I don't have any examples to
share. Hopefully someone else does. If you don't get an answer here,
I'd try asking on the Struts User list - Nabble provides a nice
interface for it.

Matt

On 10/22/07, Stephen de Vries <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I would like to display and update a checkboxlist (or any multi-
> select tag) using a List in Struts 2, but can't find complete
> documentation or an example on how I should go about it.  From
> reading bits and pieces of the fragmented docs and sparse wiki, I
> have the following so far:
>
> My action contains (with getters and setters):
>
>      private Recipient recipient;
>      private List allProfiles;
>      @Element( value = com.blah.contactn.model.Profile.class )
>      @Key( value = java.lang.Long.class )
>      @KeyProperty( value = "id" )
>      private List<Profile> selectedProfiles = new ArrayList();
>
> The model has a Recipient which contains a List<Profile> in a many-to-
> many mapping.  Profile only has two fields: Long id and String name.
>
>
> The jsp is:
> <s:checkboxlist list="allProfiles" listKey="id" listValue="name"
> label="Profiles"  name="selectedProfiles" value="recipient.profiles"/>
>
> This displays the checkboxes correctly, but when I try and submit the
> form, I get a:
>
> IllegalArgumentException occurred calling getter of
> com.corsaire.contactn.model.Profile.id; nested exception is
> org.hibernate.PropertyAccessException: IllegalArgumentException
> occurred calling getter of com.corsaire.contactn.model.Profile.id
>
> The save() method is performing:
>   recipient.setProfiles(selectedProfiles);
>   recipientManager.save(recipient);
>
>
> I've spent a frustrating 3 days trying to find a single full example
> of using any multi-select tag in Struts 2 that isn't completely
> trivial.  Surely this is one of the most common UI elements used in a
> web app?  I know this is not strictly an appfuse problem - but
> perhaps users have come across a useful example.
>
> regards,
> Stephen
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
http://raibledesigns.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to