jQuery in Action, 3rd edition
The moose likes JSF and the fly likes Selecting an item using selectOneMenu Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Selecting an item using selectOneMenu" Watch "Selecting an item using selectOneMenu" New topic

Selecting an item using selectOneMenu

Jun Bawasi

Joined: Feb 06, 2006
Posts: 1
Hello everyone, I have a little bit problem using this selectOneMenu,

I successfully load a list of items to this selectOneMenu component, I use this kind of code

in my jsf page:

in my MyTestBean.java

My problem is, for example, Today is February 7, I want to set the selectOneMenu component to select the value 7 instead of starting to 1 since it has a value of 1 to 31. Thats all.

Thanks guys.
[ February 06, 2006: Message edited by: Jun Bawasi ]
Jeremy Wilson
Ranch Hand

Joined: Feb 18, 2003
Posts: 166
I have not tried this out yet, but you should be able to set the value attribute of the selectonemenu component when the page is loaded from a separate attribute in your backing bean that returns the current day.

Jeremy Wilson
Gerardo Tasistro
Ranch Hand

Joined: Feb 08, 2005
Posts: 362
I've had an awful hard time with select lists and integer values. I convert the integer to string and back. Try to change the code to

public String getCurrentDay() {
return String.valueOf(currentDay);

public void setCurrentday (String currentDay) {
this.currentDay = Integer.valueOf(currentDay);
I agree. Here's the link: http://aspose.com/file-tools
subject: Selecting an item using selectOneMenu
It's not a secret anymore!