GeeCON Prague 2014*
The moose likes JSF and the fly likes How to get selectOneMenu value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSF
Bookmark "How to get selectOneMenu value" Watch "How to get selectOneMenu value" New topic
Author

How to get selectOneMenu value

Sami M�nnist�
Greenhorn

Joined: Sep 18, 2006
Posts: 9
Hi!
I need to get selectOneMenus selected value when page loads.
I only need it for the first time when page loads so the value is the first one in the list...But how to access it?

Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Do you want to access it by JavaScript or JSF?
Sami M�nnist�
Greenhorn

Joined: Sep 18, 2006
Posts: 9
Id rather access it by jsf but in the end either will do.
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Well, the selectOneMenu value is accessible by endpoint.protocol.

If you don't understand how it works, here is a basic working example:

JSF

MyBean
Sami M�nnist�
Greenhorn

Joined: Sep 18, 2006
Posts: 9
Thanks Bauke but the problem is that endpoint.protocol is an entity witch gets its values from database and when the user presses new endpoint on previous page new record is created and endpoit.protocol is null. I need to get the default value of selectOneMenu so I can disable certain fields.
That needs to be done only once when page loads after that javascript takes care of that when selectOneMenu changes...

Sorry for my bad presentation on my first question.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to get selectOneMenu value