aspose file tools*
The moose likes JSF and the fly likes Navigation using  valueChangeListener Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Navigation using  valueChangeListener" Watch "Navigation using  valueChangeListener" New topic
Author

Navigation using valueChangeListener

Abiodun Adisa
Ranch Hand

Joined: Jan 17, 2002
Posts: 495
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

Joined: Dec 09, 2004
Posts: 34
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"
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Navigation using valueChangeListener