Hi, I am trying to get an html:select with html:optionsCollection to set a property in my ActionForm with the actuall bean that was selected rather than the associated value:
// Bean class public class Item { int id; String name; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } } // ActionForm public class itemForm extends ActionForm { Item selectedItem; List<Item> allItems; public Item getSelectedItem() { return selectedItem; } public void setSelectedItem(Item selectedItem) { this.selectedItem = selectedItem; } public List<Item> getAllItems() { ... } } // jsp page <html:select property="selectedItem"> <html:optionsCollection property="allItems" label="name" value="id"/> </html:select> Obviously this fails since it will try and call setSelectedItem with an int value causing a argument type mismatch exception. Is there a way to make it use the actual Item Bean that was selected or it is simpler for me to just retrieve the id value and use this to match the selected bean elsewhere? Thanks in advance. Andy McDowall ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________