• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

JSF navigation questions

 
Ranch Hand
Posts: 236
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Saloon Keeper
Posts: 25477
180
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Once upon a time there were three bears. And they were visted by a golden haired tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic