Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem setting PropertyActionListener in h:selectOneMenu

 
M A Mujeeb
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 218
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic