• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Selecting an item using selectOneMenu

 
Jun Bawasi
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Gerardo Tasistro
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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);
}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic