Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSF navigation questions

 
Surendra Kumar
Ranch Hand
Posts: 236
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) Does JSF navigation accept only JSP pages to be forwarded to?
e.g., if I create a navigation rule with <to-view-id>/AddServlet</to-view-id>, the page is searching for AddServelt.jsp. Can't we forward to servlets?

2) After getting into servlet [After renaming servlet to AddServlet.jsp in web.xml, it worked.] , how to get bean properties from the form? Do we need to get bean from facesContext or request object. I tried with request object (TestBean tb = (TestBean) request.getAttribute("TestBean");), but I am getting null values.

Can you please help?
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18164
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmm. I guess that an action method is expecting to build a new JSF context outbound and thus expects that a navigation rule will only feed into another JSF page. I've never done what you're trying so I don't know the simple solution - all my links to JSP's and servlets were done on the JSF page using commandLinks.

For a JSP or servlet to work with JSF data, the data has to be accessible. That means that your servlet can get at application and session scope beans in exactly the same way you would in a non-JSF app. However page scope is obviously out, and request scope is unavailable since JSF can only do that for JSF pages. Mostly because that's a large part of what JSF pages are is JSPs with the ability to have bean information pumped into and out of them.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic