This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSF and the fly likes JSF -- Capture Target View ID after FORWARD by Navigation Handler 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 » JSF
Bookmark "JSF -- Capture Target View ID after FORWARD by Navigation Handler" Watch "JSF -- Capture Target View ID after FORWARD by Navigation Handler" New topic

JSF -- Capture Target View ID after FORWARD by Navigation Handler

Ronald Depew

Joined: Apr 26, 2006
Posts: 6
Java Ranch Community,

I'm attempting to design and create a Breadcrumbs component for a JSF Facelets Workflow Application.

I would like to assemble and stack the ViewIDs (in which I will prevent duplicates) into my Breadcrumbs component. I expect to do this in the PRE-Render Response phase.

Assuming a WAS environment and the default FORWARD technique of the NavigationHandler, I’m hoping to obtain the destination/target ViewId (of the new view) from the faces context.

(The view I expect is that of the Template Client Page which is available in Web Content.)

Will this work this way, even within a FACELETS application?

Thank you in advance,

Ron Depew
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15950

You're trying to muck around in JSF's internals. People are way too quick to do that. Most of the time, they're substituting a complex unreliable do-it-yourself solution for something that's already possible using the existing framework in a way that's much simpler and more elegant - and already debugged.

Views are not referenced by "id"s. They are referenced by a combination of URL and context. If you were to attempt navigation by brute-force manipulation of the digested view trees, you wouldn't have all the context, since part of the context is in the Model (backing beans). It just gets worse when you realize that the view state may have been serialized out to the client and back, so there's no permanent in-memory component to reference.

You could probably track progress using a PhaseListener or ServletFilter with a little help from PrettyFaces (for bookmarking). However, before you rush off and do all that, check the existing extension tagsets. I think either RichFaces or one of the MyFaces extension tagset may have a "breadcrumb" component. and if not either of them, possibly one of the other systems tat I'm less familair with. That could save a lot of time and work.

Customer surveys are for companies who didn't pay proper attention to begin with.
jQuery in Action, 2nd edition
subject: JSF -- Capture Target View ID after FORWARD by Navigation Handler
Similar Threads
What is the difference between JSP and JSF ?
Questions about the future of JSF (comparing with GWT, JavaFX)
JSF and Facelets -- Restore View on HTTP GET Method
Validating my understanding of JSF
help to understand basic concept in JSF