No, that's the facelets composition mechanism. 
Using Clay, you would need a separate HTML template for the body.
 
 

<clay:clay jsfid="/layout.html" id="layout">

     <clay:symbol name="title" value="Welcome to the Add User Page"/>

     <clay:symbol name="header" value="/header.html"/>     

     <clay:symbol name="body" value=/body.html">

</clay:clay>

 
This type of top-level definition works best when you use inheritance so that
you can define default symbol value and only override the needed
customizations.  The templates can also exist in the class path
"classpath*:com/acme/templates/body.html".
 
/body.html:
<html jsfid=void>
    <head jsfid=void><title jsfid=void>mock title</title></head>
    <body jsfid=void>
           <label for="" Name:</label><input type=text id=UserName [EMAIL PROTECTED]}>
   </body>
</html>
 
-------------- Original message --------------
From: "Garner, Shawn" <[EMAIL PROTECTED]>

Can I do this?

 

addUserPage.jsp:

 

<clay:clay jsfid="/layout.html" id="layout">

     <clay:symbol name="title" value="Welcome to the Add User Page"/>

     <clay:symbol name="header" value="/header.html"/>     

     <clay:symbol name="body">

            <h:outputLabel for="" value="User Name:"../><h:inputText id="UserName" .../>

            ...

            <h:commandButton .../>   

     </clay:symbol>     

</clay:clay>

 

 

 

Shawn

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Friday, February 24, 2006 11:57 AM
To: MyFaces Discussion
Subject: RE: [JSF] Tiles and Reusable Template

 

>From: "Garner, Shawn" <[EMAIL PROTECTED]>
>
> Alright, I looked at the symbols example in the usecases example.
> Thing I don't like about usecases is it tries to show ever feature and its
> hard for me to tell one feature from another. Even with the clay example
> there are 4 different options displayed and I can't separate them.
>

 

I think that's a common comment.  Outside a creating more example,

and better documentation, I'm not sure what the answer is but

we can always use more help here. 

 


> I like the idea of layout.html in the symbols but I don't like the way it
> uses the html body. I'm also not fond of declaring a bunch of panels and
> things inside an XML file. I would rather it was in a JSP file.
>
> I would like to be able to use the layout.html but then be able to tie this
> to a JSP View and supply the title and body content in this JSP body.
>

 

A limitation that Clay has is that you are not able to include a JSP from

a Clay XML definition or HTML template.  This is a reflection on the

fact that the JSF/JSP tags are not designed to be mixed with other view

types.

 

However, you could use JSP as your entry point and include a Clay subview

using the "clay:clay" tag. 

 

page1.jsp:

 

<clay:clay jsfid="/layout.html" id="layout">

     <clay:symbol name="header" value="/header.html"/>     

     <clay:symbol name="body" value="/page1.html"/>     

</clay:clay>

 

or

 

page1.jsp:

 

<clay:clay jsfid="basePage" id="layout">

     <clay:symbol name="header" value="/header.html"/>     

     <clay:symbol name="body" value="/page1.html"/>     

</clay:clay>

 

Clay XML Config:

 

    <!-- Base layout defintion  -->
    <component jsfid="basePage" extends="clay">
       <attributes>
           <set name="clayJsfid" value="/symbols/layout.html" />
       </attributes>
       <symbols>
           <set name="@title" value="Default Title"/>
           <set name="@leftContent" value="page3LeftPanel"/>
           <set name="@headercontent" value="/symbols/header.html"/>
           <set name="@logo" value="http://struts.apache.org/images/struts.gif"/ >
           <set name="@bodycontent" value="space"/>
           <set name="@footercontent" value="footerPanel"/>  
       </symbols>
    </component>

 

 

The catch is that you can not include another JSP from

within the "layout.html".  The JSP page would only be

the page entry point.

 

Anything included in the "layout.html" has to use clay HTML

templates or XML config definitions.

 

Originally, the JSP page entry point was the only option. 

This might make a nice sample applicaiton?

 

The option that is the most like tiles is to use an XML config as the

entry point.  The symbols "page1.xml" and "page2.xml" usecase

example shows how this works.  Both definitions are found in a

common XML.  But, the same rule about including JSP applies

here too.

 

I've been trying to figure out how to include a JSP from a clay template

but the JSP Tag is not standardized in this area.  I've been thinking about

trying to create a decorated view root and swap out the view root before

including the jsp and then swapping it back. 

 

Most people seem interested in a non-jsp solution so I haven't put much

time into this hack.


> Can anybody help me piece (pun intended) this together?
>

 

Hope that helps.


> Shawn

 

 

Gary

****************************************************************************

This email may contain confidential
material. If you were not an intended recipient,
Please notify the sender and delete all copies.
We may monitor email to and from our network.

 ***************************************************************************

 

Reply via email to