Hi

A Tiles definition is an exact mapping to a view, so you will need to have a
definition for each view. The same goes if you would want to use Clay (which
I recommend over Tiles). This is one of the nice features of these two
frameworks (?): Component inheritance. This is something that for instance
Facelets lacks.

So create a master definition (Template), and then override that definition
for each of your views, only changing the part that changes.

        <definition name="site.mainLayout" path="/jsp/mtemplate1.jsp">
                <put name="topp" value="/jsp/topp.jsp" />
                <put name="menu" value="site.menu.top" />
                <put name="submenu" value="site.menu.main" />
                <put name="helpmenu" value="site.menu.right" />
                <put name="content" value="${content}" />
                <put name="footer" value="/jsp/footer.jsp" />
                <put name="messages" value="/jsp/messages.jsp" />
        </definition>

For page1

        <definition name="site.mainLayout" path="/jsp/mtemplate1.jsp">
                <put name="content" value="/jsp/page1.jsp" />
        </definition>

For page2

        <definition name="site.mainLayout" path="/jsp/mtemplate1.jsp">
                <put name="content" value="/jsp/page2.jsp" />
        </definition>

And so on - Only overrding what differs from you master layout(s) (Which you
may have several of)

Hermod

-----Opprinnelig melding-----
Fra: JS Portal support team [mailto:[EMAIL PROTECTED] 
Sendt: 13. februar 2007 03:00
Til: [email protected]
Emne: RE: tiles integration error

Thanks Dick!

I finally got it to work!

Just one more architecture question. (I think this will show my tiles
ignorance though ;-)

Do I generate a definition for every combination of tiles? So let's say
I want to link to my dashboard and afterwards to my profile page. The
only thing that makes these two pages different is their 

<put name="content" value="/dashboard.jsp"/>
Or
<put name="content" value="/profile.jsp"/>

Or is there a way to tell tiles to browse to my definition and populate
the content with a specific tile in the link to the definition?

I already like tiles if I would have to make a definition for each view.
I would like to marry it if it would allow me the second option.

Thank you,
Joost

-----Original Message-----
From: Dick Starr [mailto:[EMAIL PROTECTED] 
Sent: Sunday, February 11, 2007 5:03 AM
To: [email protected]; [email protected]
Subject: RE: tiles integration error

<%-- starraLayout.jsp
  2007-01-11 RJS. New.
--%>
<%@ include file="/jspf/common/taglibs.jsp" %>
<%@ include file="/jspf/common/messages.jsp" %>

<%-- Layout Tiles
  This layout create a html page with <header> and <body> tags. It render
   a header, left menu, body and footer tile.
  @param title String use in page title
  @param header: Header tile (jsp url or definition name)
  @param menuBar: Menu Bar
  @param body: Body
  @param footer: Footer
--%>
<f:view>
<html>
<head>
  <link href="<h:outputText
value="#{facesContext.externalContext.requestContextPath}"/><h:outputText
value="#{msg['style.base']}"/>"
    rel="stylesheet"
    type="text/css"/>
  <title><tiles:attribute flush="false" name="title"/></title>
</head>

<body background="<h:outputText
value="#{facesContext.externalContext.requestContextPath}"/><h:outputText
value="#{msg['img.background.app']}"/>"/>
<table border="0" cellspacing="5" width="100%" >
  <tr>
    <td colspan="2"><tiles:attribute flush="false" name="header"/></td>
  </tr>
  <tr>
    <td valign="top" width="13%">
      <tiles:attribute flush="false" name="menuBar"/>
    </td>
    <td valign="top">
      <tiles:attribute flush="false" name="body"/>
    </td>    
  </tr>
  <tr>
    <td align="center" colspan="2">
      <tiles:attribute flush="false" name="info"/>
    </td>
  </tr>
  <tr>
    <td align="center" colspan="2">
      <tiles:attribute flush="false" name="footer"/>
    </td>
  </tr>
</table>
</body>
</html>
</f:view>

Here you are. I am using Tiles from "shale-framework-1.1.0-SNAPSHOT/lib"
(Shale 20070207).

Dick

Reply via email to