This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Ok, I know the subject seems odd. Basically, what I do now with plain jane JSP and Servlets is I will call a servlet which forwards to a view. That way, I never have actualy page.jsp in the URL. I always just have an action like http://localhost/action/viewform What I want to know is if there is a way to do this using JSF or if I still will do it like I am now, but the view just happens to be a JSF. I hope this makes sense. Also, #2 part of this... I will often use a Servlet to forward to a view simply to populate comboboxes and lists. So with the url above the viewform servlet will just throw some objects in the request that I foward on to the page to populate my lists and drop downs. What is the best method of doing this using JSF? Thanks. [ March 05, 2004: Message edited by: Gregg Bolinger ]
Hi Greg, Well on the first point. I'm not sure how that would work with JSF. JSF uses the incoming URL as the 'view id' and that is how it finds the existing view on the server (unless the view was serialized in the page). So if you had a bunch of pages that all when through the viewform servlet then JSF would get lost. You can configure the FacesServlet one of two ways, /faces/* or *.jsf (or another extension but takes more configuration). either way relies on putting the name of the view into the URL... For part 2: In stead of having your servlet do the fetching one of the managed beans would do that in the 'getTheList' method and your pulldown would be populated like this
I know this is probably hard to follow without all the code. Keep an eye on my blog. In a week or so I hope to have most of the code up there.
Your example makes perfect sense. I was wondering if I would be able to do it in the bean, but I wasn't sure how to approach it. Now I know. Thanks for the help. As far as #1, that kind of sucks. I really prefer not to display my technology that I am using in the URL.