• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem using Navigation Handler  RSS feed

 
Abiodun Adisa
Ranch Hand
Posts: 495
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wrote this code segment which should allow me to navigate from one page to the other whenever the valueChanged event of a drop down menu is fired. Problem is the Page navigates to an Empty Page
************************************************************************
public void valueChanged(ValueChangeEvent valueChangeEvent) {
FacesContext context=FacesContext.getCurrentInstance();
Application application=context.getApplication();
NavigationHandler navigation=application.getNavigationHandler();
navigation.handleNavigation(context,null,"\faces\index2.jsp");
context.responseComplete();
}
*************************************************************************

Pls what can be the problem
 
Ravindra Rawat
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kindly check API docs for NavigationHandler(http://java.sun.com/javaee/javaserverfaces/1.2_MR1/docs/api/index.html)

Try passing 'fromAction' and 'outcome' to match the navigation-case for the current view.

Thanks
Ravindra
 
Abiodun Adisa
Ranch Hand
Posts: 495
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was able to solve the problem i guess by trial and error even though i do not know the reason why it worked. I removed context.responseComplete() and everything worked


public void valueChanged(ValueChangeEvent valueChangeEvent) {
FacesContext context=FacesContext.getCurrentInstance();
Application application=context.getApplication();
NavigationHandler navigation=application.getNavigationHandler();
navigation.handleNavigation(context,null,"\faces\index2.jsp");
context.responseComplete();
}
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!