You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Dominik Stöttner <do...@gmx.net> on 2003/11/08 16:37:30 UTC

use of several layout-definitions

Hi,

I am trying to redesign a site with tiles and want to use several
layout-definitions. One for the layout of the whole site and several for the
different types of content. Hence, my question: Is it possible to predefine
the attributes in only one definition-file that refers to the mainLayout?
As you can see from the enclosed code-snippets I predefine all attributes
(including the modul-attributes form the modulLayout) in the
mainContnetDef.jsf although I define the content-type attribute(which refers
to the modulLayout) in the modul.jsp. Is that possible so? Or do I have to
write a extra definition for the modulLayout?

thanks in advance!!
dominik

<%-- mainLayout.jsf --%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tiles.tld" prefix="tiles" %>
<html:html>
<head>
<title><bean:message key="global.title"/></title>
<html:base/>
</head>
<body topmargin="0" leftmargin="0" bgcolor="#FFFFFF">
      <table>
        <tr>
         <td colspan=2>
          <tiles:insert attribute="header" />
         </td>
        </tr>
        <tr>
         <td>
          <tiles:insert attribute="menubar"/>
         </td>
         <td>
          <tiles:insert attribute="body-content"/>
         </td>
        </tr>
        <tr>
         <td colspan=2>
          <tiles:insert attribute="copyright"/>
         </td>
        </tr>
      </table>
</body>
</html:html>

<%-- modulLayout.jsf --%>
<center>
  <table>
    <tr>
      <td>
        <tiles:insert attribute="modul1"/>
      </td>
      <td>
        <tiles:insert attribute="modul2"/>
      </td>
    </tr>
    <tr>
      <td colspan=2>
        <tiles:insert attribute="modul3"/>
      </td>
    </tr>
  </table>
</center>

<%-- mainContentDef.jsf --%>
<%@ taglib uri="/WEB-INF/tiles.tld" prefix="tiles" %>
<tiles:definition id="defaultContent"
page="/layouts/mainLayout.jsp" scope="request">
<tiles:put name="header" value="/common/header.jsf" />
<tiles:put name="menubar" value="/common/menubar.jsf" />
<tiles:put name="copyright" value="/common/copyright.jsf" />
<tiles:put name="modul1" value="/modules/modul1.jsf" />
<tiles:put name="modul2" value="/modules/modul2.jsf" />
<tiles:put name="modul3" value="/modules/modul3.jsf" />
</tiles:definition>

<%-- modules.jsp --%>
<%@ taglib uri="/WEB-INF/tiles.tld" prefix="tiles" %>
<%@include file="../common/mainContentDef.jsf" %>
<tiles:insert beanName="defaultContent" beanScope="request">
<tiles:put name="content-type" value="../layouts/modulLayout.jsf"/>
</tiles:insert>



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: use of several layout-definitions

Posted by Dominik Stöttner <do...@gmx.net>.
Hi Adam,

first of all thanks for your reply. As you might have noticed I am not so
familiar with tiles and struts as I 'd like to be. You should not be to much
confused about the jsf extensions. I only use them to seperate "executable"
pages from others, that are only included by other pages. Hence, the only
executable file (or main page) is moduls.jsp. So far I haven't tried to use
tiles-def.xml, but maybe I should switch to that. The use of the
content-type is a mistake since I meant body-content which should refer to
the attribute used in the mainLayout.jsf.

regards,
Dominik




----- Original Message ----- 
From: "Adam Hardy" <ah...@cyberspaceroad.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Sunday, November 09, 2003 11:34 AM
Subject: Re: use of several layout-definitions


> Hi Dominik,
> it's not clear exactly which is your main page that you request from the
> browser. I use tiles-defs.xml as the repository for all my definitions,
> and I am no longer familiar with the other method that you are using -
> in fact I am even unsure whether you are using JavaServer Faces - is
> that why the files have .jsf endings?
>
>  From the start I found the tiles-defs.xml method superior. Have you
> checked it out?
>
> Also, I'm confused by your use of 'content-type': does that refer simply
> to a tiles attribute or are you also using it somehow to specify the
> response header content-type and charset? If so, it's not obvious, and
> if not, it's probably at best misleading to use the term 'content-type'
> as a name for a tiles definition.
>
> HTH
> Adam
>
> On 11/08/2003 04:37 PM Dominik Stöttner wrote:
> > I am trying to redesign a site with tiles and want to use several
> > layout-definitions. One for the layout of the whole site and several for
the
> > different types of content. Hence, my question: Is it possible to
predefine
> > the attributes in only one definition-file that refers to the
mainLayout?
>  >
> > As you can see from the enclosed code-snippets I predefine all
attributes
> > (including the modul-attributes form the modulLayout) in the
> > mainContnetDef.jsf although I define the content-type attribute(which
refers
> > to the modulLayout) in the modul.jsp. Is that possible so? Or do I have
to
> > write a extra definition for the modulLayout?
> >
> > thanks in advance!!
> > dominik
> >
> > <%-- mainLayout.jsf --%>
> > <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
> > <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
> > <%@ taglib uri="/WEB-INF/tiles.tld" prefix="tiles" %>
> > <html:html>
> > <head>
> > <title><bean:message key="global.title"/></title>
> > <html:base/>
> > </head>
> > <body topmargin="0" leftmargin="0" bgcolor="#FFFFFF">
> >       <table>
> >         <tr>
> >          <td colspan=2>
> >           <tiles:insert attribute="header" />
> >          </td>
> >         </tr>
> >         <tr>
> >          <td>
> >           <tiles:insert attribute="menubar"/>
> >          </td>
> >          <td>
> >           <tiles:insert attribute="body-content"/>
> >          </td>
> >         </tr>
> >         <tr>
> >          <td colspan=2>
> >           <tiles:insert attribute="copyright"/>
> >          </td>
> >         </tr>
> >       </table>
> > </body>
> > </html:html>
> >
> > <%-- modulLayout.jsf --%>
> > <center>
> >   <table>
> >     <tr>
> >       <td>
> >         <tiles:insert attribute="modul1"/>
> >       </td>
> >       <td>
> >         <tiles:insert attribute="modul2"/>
> >       </td>
> >     </tr>
> >     <tr>
> >       <td colspan=2>
> >         <tiles:insert attribute="modul3"/>
> >       </td>
> >     </tr>
> >   </table>
> > </center>
> >
> > <%-- mainContentDef.jsf --%>
> > <%@ taglib uri="/WEB-INF/tiles.tld" prefix="tiles" %>
> > <tiles:definition id="defaultContent"
> > page="/layouts/mainLayout.jsp" scope="request">
> > <tiles:put name="header" value="/common/header.jsf" />
> > <tiles:put name="menubar" value="/common/menubar.jsf" />
> > <tiles:put name="copyright" value="/common/copyright.jsf" />
> > <tiles:put name="modul1" value="/modules/modul1.jsf" />
> > <tiles:put name="modul2" value="/modules/modul2.jsf" />
> > <tiles:put name="modul3" value="/modules/modul3.jsf" />
> > </tiles:definition>
> >
> > <%-- modules.jsp --%>
> > <%@ taglib uri="/WEB-INF/tiles.tld" prefix="tiles" %>
> > <%@include file="../common/mainContentDef.jsf" %>
> > <tiles:insert beanName="defaultContent" beanScope="request">
> > <tiles:put name="content-type" value="../layouts/modulLayout.jsf"/>
> > </tiles:insert>
>
>
> -- 
> struts 1.1 + tomcat 5.0.12 + java 1.4.2
> Linux 2.4.20 RH9
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: use of several layout-definitions

Posted by Adam Hardy <ah...@cyberspaceroad.com>.
Hi Dominik,
it's not clear exactly which is your main page that you request from the 
browser. I use tiles-defs.xml as the repository for all my definitions, 
and I am no longer familiar with the other method that you are using - 
in fact I am even unsure whether you are using JavaServer Faces - is 
that why the files have .jsf endings?

 From the start I found the tiles-defs.xml method superior. Have you 
checked it out?

Also, I'm confused by your use of 'content-type': does that refer simply 
to a tiles attribute or are you also using it somehow to specify the 
response header content-type and charset? If so, it's not obvious, and 
if not, it's probably at best misleading to use the term 'content-type' 
as a name for a tiles definition.

HTH
Adam

On 11/08/2003 04:37 PM Dominik Stöttner wrote:
> I am trying to redesign a site with tiles and want to use several
> layout-definitions. One for the layout of the whole site and several for the
> different types of content. Hence, my question: Is it possible to predefine
> the attributes in only one definition-file that refers to the mainLayout?
 >
> As you can see from the enclosed code-snippets I predefine all attributes
> (including the modul-attributes form the modulLayout) in the
> mainContnetDef.jsf although I define the content-type attribute(which refers
> to the modulLayout) in the modul.jsp. Is that possible so? Or do I have to
> write a extra definition for the modulLayout?
> 
> thanks in advance!!
> dominik
> 
> <%-- mainLayout.jsf --%>
> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
> <%@ taglib uri="/WEB-INF/tiles.tld" prefix="tiles" %>
> <html:html>
> <head>
> <title><bean:message key="global.title"/></title>
> <html:base/>
> </head>
> <body topmargin="0" leftmargin="0" bgcolor="#FFFFFF">
>       <table>
>         <tr>
>          <td colspan=2>
>           <tiles:insert attribute="header" />
>          </td>
>         </tr>
>         <tr>
>          <td>
>           <tiles:insert attribute="menubar"/>
>          </td>
>          <td>
>           <tiles:insert attribute="body-content"/>
>          </td>
>         </tr>
>         <tr>
>          <td colspan=2>
>           <tiles:insert attribute="copyright"/>
>          </td>
>         </tr>
>       </table>
> </body>
> </html:html>
> 
> <%-- modulLayout.jsf --%>
> <center>
>   <table>
>     <tr>
>       <td>
>         <tiles:insert attribute="modul1"/>
>       </td>
>       <td>
>         <tiles:insert attribute="modul2"/>
>       </td>
>     </tr>
>     <tr>
>       <td colspan=2>
>         <tiles:insert attribute="modul3"/>
>       </td>
>     </tr>
>   </table>
> </center>
> 
> <%-- mainContentDef.jsf --%>
> <%@ taglib uri="/WEB-INF/tiles.tld" prefix="tiles" %>
> <tiles:definition id="defaultContent"
> page="/layouts/mainLayout.jsp" scope="request">
> <tiles:put name="header" value="/common/header.jsf" />
> <tiles:put name="menubar" value="/common/menubar.jsf" />
> <tiles:put name="copyright" value="/common/copyright.jsf" />
> <tiles:put name="modul1" value="/modules/modul1.jsf" />
> <tiles:put name="modul2" value="/modules/modul2.jsf" />
> <tiles:put name="modul3" value="/modules/modul3.jsf" />
> </tiles:definition>
> 
> <%-- modules.jsp --%>
> <%@ taglib uri="/WEB-INF/tiles.tld" prefix="tiles" %>
> <%@include file="../common/mainContentDef.jsf" %>
> <tiles:insert beanName="defaultContent" beanScope="request">
> <tiles:put name="content-type" value="../layouts/modulLayout.jsf"/>
> </tiles:insert>


-- 
struts 1.1 + tomcat 5.0.12 + java 1.4.2
Linux 2.4.20 RH9


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org