wood burning stoves 2.0*
The moose likes JSP and the fly likes JSF: calling a page without calling a page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSF: calling a page without calling a page" Watch "JSF: calling a page without calling a page" New topic

JSF: calling a page without calling a page

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299

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
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?
[ March 05, 2004: Message edited by: Gregg Bolinger ]

GenRocket - Experts at Building Test Data
Bill Dudney
Ranch Hand

Joined: Sep 05, 2003
Posts: 234
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.

TTFN,<br /> <br />-bd-<br /> <br /><a href="http://www.amazon.com/exec/obidos/ASIN/0471449156/qid=1064343733/sr=2-1/ref=sr_2_1/002-8375300-3666449" target="_blank" rel="nofollow">Jakarta Pitfalls</a> | <a href="http://www.amazon.com/exec/obidos/tg/detail/-/0471146153/qid=1064343733/sr=1-2/ref=sr_1_2/002-8375300-3666449?v=glance&s=books" target="_blank" rel="nofollow">J2EE AntiPatterns</a> | <a href="http://www.amazon.com/exec/obidos/tg/detail/-/0471462071/qid=1064343733/sr=1-3/ref=sr_1_3/002-8375300-3666449?v=glance&s=books" target="_blank" rel="nofollow">Mastering JavaServer Faces</a> | <a href="http://bill.dudney.net/roller/page/bill" target="_blank" rel="nofollow">Blog</a> | <a href="http://www.jroller.com/page/BillDudney" target="_blank" rel="nofollow">Eclipse Blog</a> | <a href="http://www.sourcebeat.com/TitleAction.do?id=2" target="_blank" rel="nofollow">Eclipse 3 Live</a>
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299

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.
wood burning stoves
subject: JSF: calling a page without calling a page
Similar Threads
Web application design woes
JSF Mental Block
Need a little more explanation on how to use urlmapper
integration of struts- jsf Problem related t url
First struts app help! Drop-down lists