You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Dru Nelson <dr...@redwoodsoft.com> on 2002/12/29 11:42:59 UTC
Velocity used like Tiles/Templates
Hi,
I've been reading about Tiles and the Templates layout
classes that are mentioned with Struts.
I like the idea of having a system that separates
the layout from the content.
For example, using tiles one can do this:
<%@ taglib uri="/WEB-INF/tiles.tld" prefix="tiles" %>
<tiles:insert page="/layout.jsp" flush="true">
<tiles:put name="header" value="/header.jsp"/>
<tiles:put name="body" value="/aBody.jsp"/>
<tiles:put name="footer" value="/footer.jsp"/>
</tiles:insert>
I have not used velocity, but can I assume this might
be possible? You could refer to a page and it would
in turn do several #parse passes based on some
preset variables. Has anyone contemplated this or
implemented anything like this for a large, real
site?
If it was done, what is the performance ( I didn't see any
real performance numbers on the site for velocity ).
Dru Nelson
San Carlos, California
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Velocity used like Tiles/Templates
Posted by "Geir Magnusson Jr." <ge...@adeptra.com>.
On Sunday, December 29, 2002, at 05:42 AM, Dru Nelson wrote:
>
> Hi,
>
> I've been reading about Tiles and the Templates layout
> classes that are mentioned with Struts.
>
> I like the idea of having a system that separates
> the layout from the content.
>
> For example, using tiles one can do this:
>
> <%@ taglib uri="/WEB-INF/tiles.tld" prefix="tiles" %>
>
> <tiles:insert page="/layout.jsp" flush="true">
> <tiles:put name="header" value="/header.jsp"/>
> <tiles:put name="body" value="/aBody.jsp"/>
> <tiles:put name="footer" value="/footer.jsp"/>
> </tiles:insert>
>
>
> I have not used velocity, but can I assume this might
> be possible? You could refer to a page and it would
> in turn do several #parse passes based on some
> preset variables. Has anyone contemplated this or
> implemented anything like this for a large, real
> site?
> If it was done, what is the performance ( I didn't see any
> real performance numbers on the site for velocity ).
This has been old-hat in the Velocity/WebMacro/other arena for years
now. You have it exactly right :
<html>
<table>
<tr>
<td>#parse($header)</td>
</tr>
<tr>
<td>#parse($body)</td>
</tr>
<tr>
<td>#parse($footer)</td>
</tr>
</table>
</html>
And there shouldn't be a performance hit for doing it. Give it a shot.
--
Geir Magnusson Jr 203-355-2219(w)
Adeptra, Inc. 203-247-1713(m)
geirm@adeptra.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>