aspose file tools*
The moose likes JSF and the fly likes Problem setting PropertyActionListener in h:selectOneMenu Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Problem setting PropertyActionListener in h:selectOneMenu" Watch "Problem setting PropertyActionListener in h:selectOneMenu" New topic
Author

Problem setting PropertyActionListener in h:selectOneMenu

M A Mujeeb
Greenhorn

Joined: Aug 05, 2010
Posts: 11
Hi folks,

I am trying to access the object when an option is selected from the h:selectOneMenu, following is the code snippet i am using



The above code does not set the value of the PropertyActionListener.

I am not sure how to really set the value of the selected object, into the <f:setPropertyListener.

Kindly give your feedback.

Thanks.
Brendan Healey
Ranch Hand

Joined: May 12, 2009
Posts: 218

Try this, I don't see why you'd need to use f:setPropertyActionListener:



Also you could get rid of the c:forEach and use <f:selectItems>, although I typically
have to use a converter such that the getAsString method returns the string to be displayed in the
menu, i.e.







But your way looks simpler than mine! I found this irritatingly fiddly to implement.

Regards,
Brendan.
M A Mujeeb
Greenhorn

Joined: Aug 05, 2010
Posts: 11
Brenden,

Thanks for your input. I was trying to pass an object using h:selectOneMenu, but it passes the object as a String. I finally got around by passing the Id of the selected item from dropdown and then retrieve the details on server side using that id.

C ya..
Ignacio de Cordoba
Greenhorn

Joined: Jan 04, 2010
Posts: 13
Hi there,
I am also trying to pass an object but I also get the object address passed as an string. Is it then not possible to pass a object with a h:selectOneMenu + f:selectItems combination?

Regards,
Ignacio
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem setting PropertyActionListener in h:selectOneMenu