You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Claude Brisson <cl...@renegat.net> on 2005/01/21 14:57:29 UTC

Re: Many calls to init(Object o) in tool extending ViewTool in request scop

On Thu, 2005-01-20 at 14:15 -0500, Matt Higgins wrote:
> The subject explains most of it.. 
> 
> I have a simple print line in the init function of my tool. On every
> page I hit .. including pages that don't use the tool (This makes some
> sense to me), the init function is called 22 times. This seams strange
> and wrong to me? This leads me to believe that every tool in the request
> scope will have similar behavior??? This is quite a bit of over head.
> 
> I am using Velocity with Struts / Tiles if that makes a difference. 
> 
> Is there any way to stop this? Am I using the tool box inappropriately?
> Any suggestions would be helpful. My suspicion is each tile is somehow
> generating a new request? If this is true is there a way to avoid this? 
> 
> -Matt 

The normal behaviour is one request per page/frame and one instanciation
of request tools per request. If this is not what you observe, you can
investigate.

Your suspicion is true only if Struts/Tiles, which I don't know, is
implemented using frames/iframes.

I take profit of this mail to let us speak a bit about tools (more for
devs).

We spoke before about tools pooling (especially Nathan iirc): how can it
be implemented? Using a Reusable interface with a reinit(initdata)
method?

And a suggestion on the same subject:

Maybe we could have the syntax of the scope element be:
application | session | request | <url regexp>
in toolbox.xml to refine scopes at a thiner level than the request
scope.


Claude

-- 


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