Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • 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
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

listbox help needed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We are new to JSF and were wondering how we can use a listbox and retain the change in value. The page only seems to retain the default value and we can't get it to change the value of the listbox. It doesn't seem to be calling this listener and the onChange doesn't seem to actually be working. The code we're using is below. Anyone see where we're in error?


<h:selectOneListbox id="uiSelectionField" size="1" valueChangeListener="#{projectListener.uiInitialSelections}" onChange="submit()">

<f:selectItem itemValue="Environment" itemLabel="Environment"/>
<f:selectItem itemValue="Status" itemLabel="Status"/>
<f:selectItem itemValue="Priority" itemLabel="Priority"/>
<f:selectItem itemValue="Release" itemLabel="Release"/>
<f:selectItem itemValue="Issue Type" itemLabel="Issue Type"/>
<f:selectItem itemValue="Function" itemLabel="Function"/>
<f:selectItem itemValue="Module" itemLabel="Module"/>

</h:selectOneListbox>
 
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First of all onChange has to be onchange.
To capture your listbox selection, you need to provide the value attribute that maps to a backing bean's property of type String(since your itemValues are all String).
On a different note, you do not need valueChangeListener or onchange-submit unless your other components on the same page should be repopulated based on your listbox selection.
 
Morning came much too soon and it brought along a friend named Margarita Hangover, and a tiny ad.
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic