Even after reading the Stripes documentation for Indexed properties, the
javadoc for the stripes select and option tags and browsing this list archive
I still can't figure out how to get multiple select options based on a
collection to work. I've simplified the beans described here and am focusing
just on the properites that are relevant to nested collections.
I have a Person object with ID and Name and a Meeting object with ID and List
of Person objects for the attendees.
Person
----------------------
Integer id;
Integer getId() { return id; }
void setId() { this.id = id; }
String name;
String getName() { return name; }
void setName() { this.name = name; }
Meeting
-----------------------
Integer id;
Integer getId() { return id; }
void setId() { this.id = id; }
List<Person> attendedBy;
List<Person> getAttendedBy() { return attendedBy; }
void setAttendedBy(List<Person> attendedBy) { this.attendedBy = attendedBy; }
I have an MeetingActionBean with an edit() and save() method as well as a
method that returns a list of People who could attend a meeting. This method
is to be used by the Stripes options-collection tag.
MeetingActionBean
-----------------
Meeting meeting; // with getter and setter
edit() method forwards to edit/create Meeting jsp
save() methods saves Meeting information submitted by the form
List<Person> getAllPeople() returns a list of Person objects for the option
tags
The Attendee Select box is multiple select as more than one person can attend
the meeting. The Stripes select and options tags draw the select box and
options tags based on the list of People returned by getAllPeople() - BUT when
I submit the form I see errors in the logs from DefaultActionBeanPropertyBinder
Running binding for property with name: meeting.approvedBy.id
Converting 2 value(s) using converter null (e.g. I select two people off the
list)
Looks like type converter null threw an exception.
java.lang.NoSuchMethodException: model.Person.<init>(java.lang.String)
Edit/Create Meeting.jsp select and options-collection tags
----------------------------------------------------------
<stripes:select name="meeting.attendedBy.id" value="meeting.attendeedBy.id"
multiple="true" size="5">
<stripes:option value="">--Select Attendeed By--</stripes:option>
<stripes:options-collection collection="${actionBean.allPeople}" value="id"
label="name"/>
</stripes:select>
This draws HTML like this
-------------------------
<select multiple="multiple" name="meeting.approvedBy.id">
<option value="1100">John Smith</option>
<option value="1101">Jane Smith</option>
<option value="1102">Junior Smith</option>
</select>
==========
Any help on what I am missing here would be much appreciated. The Indexed
Properties documentation appears to focus on text input boxes setting the loop
value on each text box drawn. But with the select multiple="true" and options-
collection tags I'm not sure how or where to set any loop index. What should
be the name and value attributes on the stripes:select tag?
Jonathan
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users