Recent Changes - Search:

WebFacets

HOW-TOs

Authentication



SourceForge Logo









YourKit Java Profiler

UseInControllers

You can use facets from inside your servlets, JSPs, action beans, or whatever that lives in a web container ! The only thing you actually need to obtain a ref to a JFacets object in a web component is a request. Then, you simply use facets to handle profile-related issues.

The process is pretty simple :

  • Obtain the jFacets bean using the WebFacetsFilter ;
  • Retrieve and execute facets as usual.

Of course, your facets know about the request, response and application thanks to the WebFacetsContext, so you have access to virtually anything you may need to integrate facets to your favourite technology !

Here below is a code snippet showing some facet code inside a fictious servlet :

// somewhere in a servlet, we get the jFacets bean...
WebFacets wf = WebFacets.get(request);
// somewhere again in a servlet, we use and execute facets
MyFacet myFacet = (MyFacet)wf.getFacet("doSomething", profileId, anObject);
myFacet.xxx();
String res = (String)wf.execFacet("doAnotherThing", profileId, anotherObject);

As you can see, using facets from the web tier is just as easy as in "standalone" applications.

NOTE
All this is pretty abstract, and other "patterns" explained here actually uses the present one... anyway, that's a short intro about how you can access facets in web-enabled components.
Edit - History - Print - Recent Changes - Search
Page last modified on November 03, 2006, at 02:05 PM