Another Page Fragment Tip and a Question About Perferred Tutorial Formats
By divas on Jan 24, 2006
In our last blog, Gail showed you how to access page fragment properties. Sometimes, you might want a page fragment to determine what page it is being shown in. To do that, you ask the current view for the view identifier, like this:
String viewId = getFacesContext().getViewRoot().getViewId();
This returns something like "/Page1.jsp" or "/foo/Bar.jsp", and can be used to choose conditional logic based on what page you are in.
For a simple test, add a staticText component to the page fragment, and put the following in the page fragment's init method (which gets called after the prerender() method of the page that contains the page fragment).
We have a question for you. Currently our tutorials are in HTML format. However, we have had several customer requests for the tutorials to be in PDF format. If you prefer that the tutorials are in PDF, please send us an email at CreatorDocsFeedback@Sun.Com. If we receive a sizable number of requests for PDF, then we will consider delivering future tutorial releases in both HTML and PDF.