Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Navigation using valueChangeListener

 
Abiodun Adisa
Ranch Hand
Posts: 495
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have this selectOneMenu and i would like the Page to navigate to another page whenever the user selects an item from the drop down that is when the valueChangeListener is fired. Pls how do i go about this

<h:selectOneMenu binding="#{backing_index2.selectOneMenu1}"
id="selectOneMenu1" onchange="submit()"
valueChangeListener="#{backing_index.valueChanged}">
<f:selectItem itemLabel="juju" itemValue="jubril"
binding="#{backing_index2.selectItem1}"
id="selectItem1"/>
<f:selectItem itemLabel="dodo" itemValue="abiodun"
binding="#{backing_index2.selectItem2}"
id="selectItem2"/>
<f:selectItem itemLabel="remi" itemValue="jubril"
binding="#{backing_index2.selectItem3}"
id="selectItem3"/>
</h:selectOneMenu>
 
Ravindra Rawat
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can try the following,

Use navigation handler to go to desired page as per selected item and stop furtehr JSF processing using the FacesContext.responseComplete().

FacesContext ctx = FacesContext.getCurrentInstance();
ctx.getApplication().getNavigationHandler().handleNavigation(...);
ctx.responseComplete();

Ravindra
"Hello World"
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic