The list property targets to "model" with data for rendering <select tag.

In <option tag you recieve "Item.toString" as value attribute.

After post Struts cannot set this "value" to  user.item property.

I think you must use in itemId as value for  <option value attibute
and use <s:select name="user.item.itemId"..../>




jignesh(india) wrote:
> 
> Hi,
> I am having problem while setting my selected list object directly to my
> bean class.
> My code looks like given below:-
> 
> <s:select name="user.item" list="itemList" listValue="name"/>
> 
> public MyAction extends ActionSupport {
>       ...
>       public List<Item> getItemList() {
>               return ("a list with itemobjects in it");
>       }
>       public User getUser() {
>               return "user object";
>       }
> }
> public class User {
>       private Item item;
>       public Item getItem() {
>               return item;
>       }
>       public void setItem(Item item) {
>               this.item = item;
>       }
> }
> 
> public class Item {
>       private String name;
>       public String getName() {
>               return name;
>       }
>       public void setName(String name) {
>               this.name = name;
>       }
> }
> My listKey contains the Object of type Item.
> But when i am trying to save my user object gives me following error.
> Error : Invalid field value for field "user.item".
> 
> Can anybody help me to find solution.
> Thanks in advanced,
> Jignesh
> 

-- 
View this message in context: 
http://www.nabble.com/Problem-while-setting-object-directly-from-%3Cs%3Aselect%3E-tag-tf4682431.html#a13421986
Sent from the Struts - User mailing list archive at Nabble.com.


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

Reply via email to