You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Andrew Kelso <aw...@cbincorp.com> on 2003/05/14 16:59:54 UTC

Velocity and Tiles

I have been using Struts/JSP for a while and have started using 
Struts/Velocity.

 From what I can tell, TILES does not work with Velocity.  Is this the 
case?  If so, does anyone have any advice for a replacement technology?

Thanks,
Andy


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


Re: Velocity and Tiles

Posted by Jonathan Revusky <jo...@revusky.com>.
Andrew Kelso wrote:
> I have been using Struts/JSP for a while and have started using 
> Struts/Velocity.
> 
>  From what I can tell, TILES does not work with Velocity.  Is this the 
> case?  If so, does anyone have any advice for a replacement technology?

Andrew,

If you want to use a template engine instead of JSP, you might well 
consider FreeMarker. Since it now supports the use of third-party JSP 
taglibs, opting for FM as your view technology does not imply any of the 
same tradeoffs that you refer to above. Basically, you get to have your 
cake and eat it too.

Here is a link to the manual section that explains how to use FreeMarker 
with Struts and also how to configure third-party JSP taglibs (like 
Tiles) so that they can be used from within a FreeMarker template.

http://freemarker.org/docs/pgui_misc_servlet.html

In general, FreeMarker is a more powerful template engine that is 
undergoing far more active development than Velocity. Here is a link to 
a not necessarily objective comparison of FreeMarker with Velocity:

http://freemarker.org/fmVsVel.html

It is not very hard to switch from Vel->FM, since we have an automatic 
template conversion utility.

Best Regards,

Jonathan Revusky
--
lead developer, FreeMarker project, http://freemarker.org/

> 
> Thanks,
> Andy



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


RE: Velocity and Tiles

Posted by Hue Holleran <hu...@openAction.net>.
>> I was thinking along the lines of a Velocity Tool kit for Tiles.
Similar to how Struts is used in Velocity. <<

Are we talking about the same thing - can you give a bit more information?
Rightly or wrongly, I see Velocity as another view mechanism for Struts - in
this regard I see Velocity being used in Struts (and not the other way
'round).

I can see how the basic templating functionality could be done in Velocity -
Ted Husted has already documented a basic way of doing this, but by Ted's
own admissions it does not have any of the advanced Tiles capabilities: tile
controller, defs in XML, nor 'extends' inheritance capability to name just a
few.

My query is whether Tiles can be extended to 'understand' that certain tiles
need to be forwarded to Velocity for rendering, making available in the
Velocity context not just the usual variables that Velocity takes from
Struts but also the tiles attributes too. Is this what you're trying to
achieve?

H.

> -----Original Message-----
> From: Andrew Kelso [mailto:awkelso@cbincorp.com]
> Sent: 14 May 2003 17:00
> To: Struts Users Mailing List
> Subject: Re: Velocity and Tiles
>
>
> I was thinking along the lines of a Velocity Tool kit for Tiles.
> Similar to how Struts is used in Velocity.
>
> -Andy
>
> Hue Holleran wrote:
>
> >What about a plug-in for tiles?
> >
> >I wonder about providing some type of plug-in (I guess)
> capability to tiles
> >so that it could be extended to process other types of view, too, e.g.
> >initially .vm - this would allow anyone to leverage all of the
> really great
> >tiles capabilities to other views. Imagine how powerful this
> would be, the
> >tiles could be any form of view: Velocity, Cocoon, JSF... etc.
> >
> >The velocity team have already done a great job of using a .vm
> in place of a
> >.jsp by using a custom VelocityStruts servlet to map items in
> various scopes
> >to the Velocity objects to make the intrinsic JSP objects,
> request, session,
> >etc., as well as beans accessible to Velocity. But this does not have any
> >capability for tiles - Ted (Husted) has done some work to give a very
> >fundamental early templating capability to Velocity - but
> imagine the work
> >to redo tiles into Velocity, with defs, extended defs, etc. etc. (No mean
> >feat!!!)
> >
> >JSP could be just another type of plug-in, although not undoing
> all of the
> >optimisation work that has been done for JSPs - so JSP may be a specific
> >implementation with additional add-ons for other view types. I did wonder
> >whether view types could be defined as servlet mappings on extension in
> >web.xml and tiles could just 'pass' (excuse my lack of a mor
> precise term)
> >the processing of the view to the servlet.
> >
> >In all of the different technologies I've worked with over the
> years - and
> >there've have been a few(!) - I have never seen anything with the power,
> >flexibility, capability and robustness of tiles - it seems a
> shame to limit
> >it to JSPs - I was trying to find a way of extending it so that
> the power of
> >tiles can be used with other presentation technologies.
> >
> >I was after some pointers on what changes would be required so that tiles
> >could include a .vm instead of a .jsp, e.g. if I had the
> following in a def:
> >
> >  <definition name="rootLayout" path="/tiles-layouts/rootLayout.jsp">
> >    <put name="titleString" value="CHANGE-ME"/>
> >    <put name="header" value="/tiles-components/global/header.jsp"/>
> >    <put name="body"   value="/velocity/page.vm"/>
> >  </definition>
> >
> >When <tiles:insert ... > is done, e.g.
> >
> >  <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
> >
> >  <tiles:insert definition="rootLayout">
> >    <tiles:put name="titleString" value="This is my title"/>
> >  </tiles:insert>
> >
> >This will include the <put's from the def, well the .jsp works fine for
> >tiles - I'm wondering about the changes needed for including the .vm (and
> >others) as well.
> >
> >Any ideas - does any of this make sense or is this just silly?
> >
> >Hue.
> >
> >
> >
> >>-----Original Message-----
> >>From: Andrew Kelso [mailto:awkelso@cbincorp.com]
> >>Sent: 14 May 2003 16:00
> >>To: struts-user@jakarta.apache.org
> >>Subject: Velocity and Tiles
> >>
> >>
> >>I have been using Struts/JSP for a while and have started using
> >>Struts/Velocity.
> >>
> >> From what I can tell, TILES does not work with Velocity.  Is this the
> >>case?  If so, does anyone have any advice for a replacement technology?
> >>
> >>Thanks,
> >>Andy
> >>
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> >>For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >>
> >>
> >>
> >>---
> >>Incoming mail is certified Virus Free.
> >>Checked by AVG anti-virus system (http://www.grisoft.com).
> >>Version: 6.0.478 / Virus Database: 275 - Release Date: 06/05/2003
> >>
> >>
> >>
> >---
> >Outgoing mail is certified Virus Free.
> >Checked by AVG anti-virus system (http://www.grisoft.com).
> >Version: 6.0.478 / Virus Database: 275 - Release Date: 06/05/2003
> >
> >
> >---------------------------------------------------------------------
> >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
>
>
>
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.478 / Virus Database: 275 - Release Date: 06/05/2003
>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.478 / Virus Database: 275 - Release Date: 06/05/2003


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


Re: Velocity and Tiles

Posted by Andrew Kelso <aw...@cbincorp.com>.
I was thinking along the lines of a Velocity Tool kit for Tiles.   
Similar to how Struts is used in Velocity.

-Andy

Hue Holleran wrote:

>What about a plug-in for tiles?
>
>I wonder about providing some type of plug-in (I guess) capability to tiles
>so that it could be extended to process other types of view, too, e.g.
>initially .vm - this would allow anyone to leverage all of the really great
>tiles capabilities to other views. Imagine how powerful this would be, the
>tiles could be any form of view: Velocity, Cocoon, JSF... etc.
>
>The velocity team have already done a great job of using a .vm in place of a
>.jsp by using a custom VelocityStruts servlet to map items in various scopes
>to the Velocity objects to make the intrinsic JSP objects, request, session,
>etc., as well as beans accessible to Velocity. But this does not have any
>capability for tiles - Ted (Husted) has done some work to give a very
>fundamental early templating capability to Velocity - but imagine the work
>to redo tiles into Velocity, with defs, extended defs, etc. etc. (No mean
>feat!!!)
>
>JSP could be just another type of plug-in, although not undoing all of the
>optimisation work that has been done for JSPs - so JSP may be a specific
>implementation with additional add-ons for other view types. I did wonder
>whether view types could be defined as servlet mappings on extension in
>web.xml and tiles could just 'pass' (excuse my lack of a mor precise term)
>the processing of the view to the servlet.
>
>In all of the different technologies I've worked with over the years - and
>there've have been a few(!) - I have never seen anything with the power,
>flexibility, capability and robustness of tiles - it seems a shame to limit
>it to JSPs - I was trying to find a way of extending it so that the power of
>tiles can be used with other presentation technologies.
>
>I was after some pointers on what changes would be required so that tiles
>could include a .vm instead of a .jsp, e.g. if I had the following in a def:
>
>  <definition name="rootLayout" path="/tiles-layouts/rootLayout.jsp">
>    <put name="titleString" value="CHANGE-ME"/>
>    <put name="header" value="/tiles-components/global/header.jsp"/>
>    <put name="body"   value="/velocity/page.vm"/>
>  </definition>
>
>When <tiles:insert ... > is done, e.g.
>
>  <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
>
>  <tiles:insert definition="rootLayout">
>    <tiles:put name="titleString" value="This is my title"/>
>  </tiles:insert>
>
>This will include the <put's from the def, well the .jsp works fine for
>tiles - I'm wondering about the changes needed for including the .vm (and
>others) as well.
>
>Any ideas - does any of this make sense or is this just silly?
>
>Hue.
>
>  
>
>>-----Original Message-----
>>From: Andrew Kelso [mailto:awkelso@cbincorp.com]
>>Sent: 14 May 2003 16:00
>>To: struts-user@jakarta.apache.org
>>Subject: Velocity and Tiles
>>
>>
>>I have been using Struts/JSP for a while and have started using
>>Struts/Velocity.
>>
>> From what I can tell, TILES does not work with Velocity.  Is this the
>>case?  If so, does anyone have any advice for a replacement technology?
>>
>>Thanks,
>>Andy
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>
>>
>>
>>---
>>Incoming mail is certified Virus Free.
>>Checked by AVG anti-virus system (http://www.grisoft.com).
>>Version: 6.0.478 / Virus Database: 275 - Release Date: 06/05/2003
>>
>>    
>>
>---
>Outgoing mail is certified Virus Free.
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.478 / Virus Database: 275 - Release Date: 06/05/2003
>
>
>---------------------------------------------------------------------
>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: Velocity and Tiles

Posted by Hue Holleran <hu...@openAction.net>.
What about a plug-in for tiles?

I wonder about providing some type of plug-in (I guess) capability to tiles
so that it could be extended to process other types of view, too, e.g.
initially .vm - this would allow anyone to leverage all of the really great
tiles capabilities to other views. Imagine how powerful this would be, the
tiles could be any form of view: Velocity, Cocoon, JSF... etc.

The velocity team have already done a great job of using a .vm in place of a
.jsp by using a custom VelocityStruts servlet to map items in various scopes
to the Velocity objects to make the intrinsic JSP objects, request, session,
etc., as well as beans accessible to Velocity. But this does not have any
capability for tiles - Ted (Husted) has done some work to give a very
fundamental early templating capability to Velocity - but imagine the work
to redo tiles into Velocity, with defs, extended defs, etc. etc. (No mean
feat!!!)

JSP could be just another type of plug-in, although not undoing all of the
optimisation work that has been done for JSPs - so JSP may be a specific
implementation with additional add-ons for other view types. I did wonder
whether view types could be defined as servlet mappings on extension in
web.xml and tiles could just 'pass' (excuse my lack of a mor precise term)
the processing of the view to the servlet.

In all of the different technologies I've worked with over the years - and
there've have been a few(!) - I have never seen anything with the power,
flexibility, capability and robustness of tiles - it seems a shame to limit
it to JSPs - I was trying to find a way of extending it so that the power of
tiles can be used with other presentation technologies.

I was after some pointers on what changes would be required so that tiles
could include a .vm instead of a .jsp, e.g. if I had the following in a def:

  <definition name="rootLayout" path="/tiles-layouts/rootLayout.jsp">
    <put name="titleString" value="CHANGE-ME"/>
    <put name="header" value="/tiles-components/global/header.jsp"/>
    <put name="body"   value="/velocity/page.vm"/>
  </definition>

When <tiles:insert ... > is done, e.g.

  <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>

  <tiles:insert definition="rootLayout">
    <tiles:put name="titleString" value="This is my title"/>
  </tiles:insert>

This will include the <put's from the def, well the .jsp works fine for
tiles - I'm wondering about the changes needed for including the .vm (and
others) as well.

Any ideas - does any of this make sense or is this just silly?

Hue.

> -----Original Message-----
> From: Andrew Kelso [mailto:awkelso@cbincorp.com]
> Sent: 14 May 2003 16:00
> To: struts-user@jakarta.apache.org
> Subject: Velocity and Tiles
>
>
> I have been using Struts/JSP for a while and have started using
> Struts/Velocity.
>
>  From what I can tell, TILES does not work with Velocity.  Is this the
> case?  If so, does anyone have any advice for a replacement technology?
>
> Thanks,
> Andy
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.478 / Virus Database: 275 - Release Date: 06/05/2003
>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.478 / Virus Database: 275 - Release Date: 06/05/2003


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