You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Leif Ashley <le...@yahoo.com> on 2004/03/02 23:01:20 UTC

Macro or Tool(box)

Is there any "best practices" as to when to use a
macro or a tool in the toolbox?

__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you�re looking for faster
http://search.yahoo.com

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


Re: Macro or Tool(box)

Posted by Claude Brisson <cl...@renegat.net>.
Leif Ashmey wrote :
> Something that just occured to me in this regard. The
> toolbox is primarily for static tools, is it not?
> 
> For example, if I wanted to have a specific page object
> created by a struts action, then putting this in the
> toolbox wouldn't be any use as I can see. It looks to be
> more for things like formatters and other "quickie"
> rendering tools.
> 


Tools aren't static - tools have a scope, which can be the request, the session or the application.

CloD



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


Re: Macro or Tool(box)

Posted by "J. B. Rainsberger" <jb...@rogers.com>.
Leif Ashley wrote:

> Something that just occured to me in this regard. The
> toolbox is primarily for static tools, is it not?

This is how I use it. It's like an application context, rather than a 
page context.
-- 
J. B. Rainsberger,
Diaspar Software Services
http://www.diasparsoftware.com :: +1 416 791-8603
Let's write software that people understand

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


Re: Macro or Tool(box)

Posted by Nathan Bubna <na...@esha.com>.
Leif Ashley said:
> Something that just occured to me in this regard. The
> toolbox is primarily for static tools, is it not?

if by toolbox you mean the toolbox support in VelocityTools, then the answer
is no. it is not primarily for static tools.  Tools are request-scoped by
default, and if they implement the ViewTool interface, they will be
initialized with access to the current req/res/sess/app.

> For example, if I wanted to have a specific page object
> created by a struts action, then putting this in the
> toolbox wouldn't be any use as I can see. It looks to be
> more for things like formatters and other "quickie"
> rendering tools.

the Generic Tools fall into the category, but the tools in VelocityView and
VelocityStruts are *very* useful for doing work in a specific page for a
specific request.

> Thanks for the reply.
>
> --- Geir Magnusson Jr <ge...@4quarters.com> wrote:
> > Simple rule of thumb :
> >
> > if it involves markup, use a macro.  if it's done in Java
> > code (no
> > output markup), then do a tool

+1

> > On Mar 2, 2004, at 5:01 PM, Leif Ashley wrote:
> >
> > > Is there any "best practices" as to when to use a
> > > macro or a tool in the toolbox?
...

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


Re: Macro or Tool(box)

Posted by Leif Ashley <le...@yahoo.com>.
Something that just occured to me in this regard. The
toolbox is primarily for static tools, is it not?

For example, if I wanted to have a specific page object
created by a struts action, then putting this in the
toolbox wouldn't be any use as I can see. It looks to be
more for things like formatters and other "quickie"
rendering tools.

Thanks for the reply.

--- Geir Magnusson Jr <ge...@4quarters.com> wrote:
> Simple rule of thumb :
> 
> if it involves markup, use a macro.  if it's done in Java
> code (no 
> output markup), then do a tool
> 
> On Mar 2, 2004, at 5:01 PM, Leif Ashley wrote:
> 
> > Is there any "best practices" as to when to use a
> > macro or a tool in the toolbox?
> >
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! Search - Find what you�re looking for faster
> > http://search.yahoo.com
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> velocity-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> velocity-user-help@jakarta.apache.org
> >
> >
> -- 
> Geir Magnusson Jr                                  
> 203-247-1713(m)
> geir@4quarters.com
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> velocity-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you�re looking for faster
http://search.yahoo.com

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


Re: Macro or Tool(box)

Posted by Geir Magnusson Jr <ge...@4quarters.com>.
Simple rule of thumb :

if it involves markup, use a macro.  if it's done in Java code (no 
output markup), then do a tool

On Mar 2, 2004, at 5:01 PM, Leif Ashley wrote:

> Is there any "best practices" as to when to use a
> macro or a tool in the toolbox?
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Search - Find what you’re looking for faster
> http://search.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>
-- 
Geir Magnusson Jr                                   203-247-1713(m)
geir@4quarters.com


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