• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Selecting an item using selectOneMenu

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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);
}
 
grapes are vegan food pellets. Eat this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic