You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Mike Haberman <mi...@ncsa.uiuc.edu> on 2004/07/20 17:12:25 UTC
Velocity/Struts template question
Hey,
I've just started an attempt to port a Turbine/Velocity project to
Struts/Velocity. When I am rendering the page, I need to know the name
of the template that I am rendering (without having to do
#set ($templateName = "index.vm") in every template.
In some cases, the request will be going through struts frist,
in others it will be going just through the VelocityLayoutServlet.
Is there a tool that does this or do I need to extend VelocityLayoutServlet
to add to the context the name of the current template being rendered?
thanks!
mike
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: Velocity/Struts template question
Posted by Nathan Bubna <na...@esha.com>.
Mike Haberman said:
> I've just started an attempt to port a Turbine/Velocity project to
> Struts/Velocity. When I am rendering the page, I need to know the name
> of the template that I am rendering (without having to do
> #set ($templateName = "index.vm") in every template.
>
> In some cases, the request will be going through struts frist,
> in others it will be going just through the VelocityLayoutServlet.
>
> Is there a tool that does this or do I need to extend
VelocityLayoutServlet
> to add to the context the name of the current template being rendered?
i'm not aware of a current tool that does this. so, yeah, the simplest way is
probably to extend the VLS and add the template name to the context during the
handleRequest(req,res,ctx) method. though do note that that method is not
empty, so you will likely want to call super.handleRequest() or duplicate the
superclass content for that method.
Nathan Bubna
nathan@esha.com
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org