Recent Changes - Search:

WebFacets

HOW-TOs

Authentication



SourceForge Logo









YourKit Java Profiler

ViewHelpers

This "pattern" allows to present profiled data to the end-user based on his profile.

The idea is that you use facets as kind of "backing beans" for the views. This way, the view does not care about who is asking for rendering : it simply asks for a facet for the current profile and present some information in it !

Here under is an example, inside a fictious JSP, using the WebFacets taglib :

<!-- First, we obtain the facet... -->
<wf:useFacet name="myViewHelper" profileId="${profileId}" targetObject="${anObject}" var="myVH"/>

<!-- And we use it to present some data -->
<h1>${myVH.title}</h1>
<p>
  Here are the items :
  <ul>
  <c:forEach items="${myVH.aCollection}" var="item">
    <li>${item.name}</li>
  </c:forEach>
  </ul>
</p>
...

This is pretty big, since it allows to easily perform profile-based customizations in the page with no dirty switches everywhere and such ugly stuff. Want some examples ? Well, what about profilizing a few things in the <head> block of the page, like links to CSSs ? Oh, bored with headers with the username and other recurrent "portal-like" bullshit ? What about navbars, menus etc ? ... I think you're getting it ;-)

This pattern is implemented in the Examples? using plain JSPs + JSTL.

Edit - History - Print - Recent Changes - Search
Page last modified on August 27, 2006, at 04:09 PM