It's not a secret anymore!
The moose likes JSF and the fly likes JSF navigation questions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF navigation questions" Watch "JSF navigation questions" New topic

JSF navigation questions

Surendra Kumar
Ranch Hand

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

Joined: Jun 25, 2001
Posts: 17417

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.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: JSF navigation questions
It's not a secret anymore!