You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Kenny Grimm <gr...@sysdump.com> on 2001/12/05 08:43:06 UTC
Best way to have truly dynamic templates?
Hi,
I'm currently working on a site in which I'd like every page accessed to
follow the same template, as I'm sure most sites do. I am ending up with 2
files now for every different page on the site, 1 which states that I'd like
to follow the template, and then the main jsp part of that page, for
example:
siteTemplate.jsp
introStructure.jsp (contains template:insert)
intro.jsp (part of introStructure.jsp)
searchStructure.jsp
search.jsp
......
This is getting very redundant. Any other options?
Thanks,
Kenny
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Best way to have truly dynamic templates?
Posted by Jerry Workman <je...@mtncad.com>.
Cedric / Kenny,
Tiles is a bit of overkill to do simple header / footer / menu templates.
I use the following which works quite well and avoids the need for 2 JSP
files for each page.
<%@ taglib uri="/WEB-INF/tlds/struts-template.tld" prefix="template" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<template:insert template='/mainTemplate.jsp'>
<template:put name='title' direct='true'>My page title</template:put>
<template:put name='header' direct='true'>
<bean:message key="header.app.title"/>
</template:put>
<template:put name='sidebar' content='/sidebarTemplate.jsp' />
<template:put name='content'>
Page content which can contain JSP and scriptlets.
</template:put>
</template:insert>
mainTemplate.jsp then contains the <template:get name='whatever'/> tags for
each of the template:puts as well as your layout.
Jerry
----- Original Message -----
From: "Cedric Dumoulin" <ce...@lifl.fr>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Thursday, December 06, 2001 5:12 AM
Subject: Re: Best way to have truly dynamic templates?
Hello,
Have you check Tiles library ?
It allows to specify "definitions" in a centralized xml file. Combine it
with
Struts actions, and you will avoid the second jsp file.
Cedric
Kenny Grimm wrote:
> Hi,
> I'm currently working on a site in which I'd like every page accessed to
> follow the same template, as I'm sure most sites do. I am ending up with
2
> files now for every different page on the site, 1 which states that I'd
like
> to follow the template, and then the main jsp part of that page, for
> example:
>
> siteTemplate.jsp
>
> introStructure.jsp (contains template:insert)
> intro.jsp (part of introStructure.jsp)
> searchStructure.jsp
> search.jsp
> ......
>
> This is getting very redundant. Any other options?
>
> Thanks,
> Kenny
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Best way to have truly dynamic templates?
Posted by Cedric Dumoulin <ce...@lifl.fr>.
Hello,
Have you check Tiles library ?
It allows to specify "definitions" in a centralized xml file. Combine it with
Struts actions, and you will avoid the second jsp file.
Cedric
Kenny Grimm wrote:
> Hi,
> I'm currently working on a site in which I'd like every page accessed to
> follow the same template, as I'm sure most sites do. I am ending up with 2
> files now for every different page on the site, 1 which states that I'd like
> to follow the template, and then the main jsp part of that page, for
> example:
>
> siteTemplate.jsp
>
> introStructure.jsp (contains template:insert)
> intro.jsp (part of introStructure.jsp)
> searchStructure.jsp
> search.jsp
> ......
>
> This is getting very redundant. Any other options?
>
> Thanks,
> Kenny
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>