After playing with it some more, I figured out the answer to my question. :-)

The trick was to use the "clay" component (or a component derived from "clay") 
and pass the configurable parts to the "clayJsfid" attribute (instead of trying 
to pass them as part of the "jsfid" attribute directly), like so:


In my JSP:

<f:loadBundle basename="runtime" var="runtime" />
<c:clay 
        id="testPage" 
        jsfid="templateTestPage" 
>
        <c:symbol name="pageTitle" value="Test of template" />
        <c:symbol name="templatesPrefix" value="#{runtime.templatesPrefix}" />
        <c:symbol name="themeName" value="#{runtime.themeName}" />
</c:clay>


In my clay-config.xml:

<component jsfid="basePage" extends="clay">
        <attributes>
                <set name="clayJsfid" 
value="@templatesPrefix/@themeName/html.html" />
        </attributes>
</component>    
        
<component jsfid="templateTestPage" extends="basePage">
        <symbols>
                <set name="bodyTemplate" 
value="@templatesPrefix/@themeName/bodyTemplate.html" />
        </symbols>
</component>


In this case, I'm using a message bundle named runtime.properties to pass in 
the theme name, but presumably, one could use a managed bean in the same way to 
obtain the theme name from user preferences.





Rich Eggert
Member of Technical Staff
Proteus Technologies, LLC
http://www.proteus-technologies.com



-----Original Message-----
From: Richard Eggert [mailto:[EMAIL PROTECTED]
Sent: Sat 2/17/2007 3:53 PM
To: user@shale.apache.org
Subject: Dynamically-selectable HTML templates
 
In an application I'm working on, I'm trying to implement a mechanism by which 
the exact HTML template file that is used for a given page is dependent upon a 
configurable (at a minimum, by the person deploying the application, but 
ideally, in the profile of each user) parameter such that although the actual 
information displayed by a given page remains the same, the layout and 
formatting of the page may vary according to the site "theme" selected by the 
site owner and/or user preferences.  After doing some experimenting, I 
discovered that expressions are not allowed in the jsfid attribute of the 
"clay" JSP tag.  Is there some other way of implementing this?  Is what I'm 
trying to do even feasible with Clay?


Rich Eggert
Member of Technical Staff
Proteus Technologies, LLC
http://www.proteus-technologies.com


Reply via email to