1 Reply Latest reply on Aug 31, 2012 1:18 AM by Vikas V

    Unable to find ServletResponse Facelet viewId:

    Vikas V Newbie

      Am using JSF 1.2. In my PhaseListener I want to redirect to success or error page based on the result.

      For that am using below piece of code

       

      FacesContext facesContext = null; 

      facesContext = e.getFacesContext();   

      facesContext.getApplication().getNavigationHandler().handleNavigation(facesContext,"","success");

       

      I have the required entries for "success" in faces-config.xml

      But, this is not redirecting to success.xhtml page.

      I am getting the folowing error

       

      [viewhandler] Unable to find ServletResponse Facelet viewId: /jsp/html/success.xhtml

       

      I also gave a try with below piece of code. Even then its not working

       

      FacesContext context = FacesContext.getCurrentInstance(); 

      UIViewRoot newPage = context.getApplication().getViewHandler().createView(context,"/jsp/html/successful.jsf");  

      context.setViewRoot(newPage);  

      context.renderResponse();

       

      Above code, when I had tried with a Portlet it was working. Now when am trying to implement the same in a Servlet its not working

        • 1. Re: Unable to find ServletResponse Facelet viewId:
          Vikas V Newbie

          This is a JSF based Servlet web application. Request first goes to doGet method of my Servlet. I have this code in my doGet method MyBean myBean = (MyBean) request.getSession().getAttribute("myBean"); After this PhaseListener gets called. And in PhaseListener I have the above NavigationHandler code. But, still am getting Unable to find ServletResponse Facelet viewId: . What could be the posssible cause for this error?