Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Advanced theming concepts for JSF (Facelets)?

 
Alex MacFarlane
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
TL;DR: Looking for ideas on how to do advanced theming in JSF, looking for more than just CSS/image libs tricks, need full ‘view’ customization. Any ideas or concepts would be appreciated.

We are attempting to build advanced themeing into a new version of our web application, to allow us to use one platform to provide many different brand/white label shops. Specifically, we need to have more customizability than pure CSS+image libraries+localization can provide.

Has anybody had any experience with this or as any concepts/ideas on one how would do this?

We are looking at ways we can modify/swap out the view based on runtime configuration, two concepts we have so far are:
  • Augment the JSF life cycle, allowing components to be swapped out with the themed versions as the request is being processed. Seems like a clean way which would provide the ability to provide defaulting if a themed version is missing? One problem, we have no idea how to do this, or if this is even possible, any pointers would be much appreciated.
  • Use includes with EL’s to replace ‘abstract’ the actual components i.e. <ui: include src="login_#{theme.shortname}.xhtml"/>. This is ugly but relatively easy.


  • One of the current proposals is using Spring MVC is to use a custom view resolver to use serve up different templates based on the request domain. However we really want to use a component based framework to take advantages of the benefits it brings.

    Any input would be most welcome and some of us really don’t want to build another shop in Spring MVC!
     
    Tim Holloway
    Bartender
    Posts: 18419
    60
    Android Eclipse IDE Linux
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    RichFaces is a tagset that supports theming (or "skinning"). In fact, you can specify a theme in your web.xml, which is sufficient assuming you deploy one WAR per theme user.

    If you actually want to make the page layouts vary, that should be doable by tweaking how Facelets resolves template requests, but most of that work is going to have to be something you do for yourself; I don't know of any parameterized/environmentally-driven standard mechanisms.
     
    Alex MacFarlane
    Greenhorn
    Posts: 4
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    For all those interested, this is what we have found so far.

  • Templates can be easily dynamically swapped out by using a custom ResourceResolver that overrides the DefaultResourceResolver and is set using the 'facelets.RESOURCE_RESOLVER' context-param.
  • Currently using EL for CSS, looking for a better solution.
  • Suspect that for swapping out view/components we can use event listeners (i.e. PreRenderViewEvent), still looking into this, any tips would be most welcome.

  •  
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!