velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Barbara Baughman <>
Subject Re: Keep vectors value in context
Date Wed, 30 Aug 2006 16:47:11 GMT
If the vectors are particular to a session, you can store them in the
session and then pass them to the context the next time.

Object vectors=session.getAttribute("vectors");
if (vectors==null) {
   // build the vectors
} else {

Or, use a velocity servlet that automatically send the session objects
to the Velocity context.

The VelocityContext is rebuilt for every HTTP request, either
explicityly or behind the scenes.  The best you can do is avoid
repopulating the vectors.

Barbara Baughman

On Wed, 30 Aug 2006, Carlo Torniai wrote:

> Hi there.
> I'm using a servlet to build some vectors that are used by a velocity
> template.
> I call the same servlet with different parameters and I would like to
> keep the value of vectors stored in the context according to some
> parameters value.
> But i found that every time i call the servlet the vectors has to be
> populated and added to the context.
> The question is: how can I add vectors to the context so that they can
> be persistent (i.e. no need to populate them and to add them to the
> context every time the servlet is called) during a user session?
> Thanks
> Carlo
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message