This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSF and the fly likes Problem navigating to JSF from servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Problem navigating to JSF from servlet" Watch "Problem navigating to JSF from servlet" New topic
Author

Problem navigating to JSF from servlet

Leslie Liew Eng Chuan
Greenhorn

Joined: Jul 04, 2006
Posts: 2
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

Joined: Jul 04, 2006
Posts: 2
// 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>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem navigating to JSF from servlet
 
Similar Threads
navigation rules are not working...
Navigation Problem using JDeveloper
navigation to servlets in JSF 2.0
FacesContext is null inside managed bean
JSF with Facelets - Using "h:commandLink" inside header of the layout