• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem navigating to JSF from servlet

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have set some session attributes in servlet and I intend to have them retrieved in JSF page. But now the problem Im having now is I dont know what went wrong when I tried to direct to JSF component from servlet. May i know the full API from navigating from servlet to JSF page, please.. and what are the paths I need to set in faces-configs.xml

These are the code that s giving me problem.

I have all these line of codes in doGet( HttpServletRequest req, HttpServletResponse response )

JsfHelper.setSessionAttribute("taskFormParameters", taskFormParameters);

FacesContext context = FacesContext.getCurrentInstance();
javax.faces.application.Application app = context.getApplication();
UIViewRoot viewRoot = app.getViewHandler().createView(facesContext, "/faces/task");
facesContext.setViewRoot(viewRoot);
facesContext.renderResponse();


I also have this line defined in faces-config.xml

<navigation-rule>
<from-view-id>/autocomplete/*</from-view-id>
<navigation-case>
<from-outcome>task</from-outcome>
<to-view-id>/task.jsp</to-view-id>
</navigation-case>
</navigation-rule>


And for some reasons, the navigation just doesn't go through. Any idea? Been looking for a workaround for hours but still couldn't find any. WIll be waiting for an answer here...Any help will be appreciated. thanks...
 
Leslie Liew Eng Chuan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
// this is to set attributes into the session
JsfHelper.setSessionAttribute("taskFormParameters", taskFormParameters);

// this is to navigate to JSF page from servlet - something goes wrong here // I think
FacesContext context = FacesContext.getCurrentInstance();
javax.faces.application.Application app = context.getApplication();
UIViewRoot viewRoot = app.getViewHandler().createView(facesContext, "/faces/task");
facesContext.setViewRoot(viewRoot);
facesContext.renderResponse();


I also have this line defined in faces-config.xml

<navigation-rule>
<from-view-id>/autocomplete/*</from-view-id>
<navigation-case>
<from-outcome>task</from-outcome>
<to-view-id>/task.jsp</to-view-id>
</navigation-case>
</navigation-rule>
 
reply
    Bookmark Topic Watch Topic
  • New Topic