velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathan Bubna" <nbu...@gmail.com>
Subject Re: Keep vectors value in context
Date Wed, 30 Aug 2006 15:03:44 GMT
On 8/30/06, Felix Satyaputra <f_satyaputra@yahoo.co.uk> wrote:
> Hi Carlo,
>
> Is this servlet extended from VelocityServlet in
> velocity tools project?
>
> http://jakarta.apache.org/velocity/tools/javadoc/org/apache/velocity/tools/view/servlet/VelocityViewServlet.html
>
> This servlet puts request, session, & servlet context
> (I think) inside velocity context for every request.

Yep.  The response too.

> Your servlet (if it's custom build) can do the same
> thing - put request & session in velocity context.
> Then store the vector in session.
>
> Assuming session is stored under the key 'session' in
> velocity context, to use from velocity,
>
> #set ($myVector =
> $session.getAttribute('myVectorAttribute'))

If you are using the VelocityViewServlet, then request, session and
servlet context attributes are automatically retrieved when asked for,
so this could become just

$myVectorAttribute

> A little work around, I guess...
>
> Cheers,
>
> Felix
>
>
> --- Carlo Torniai <carlo.torniai@hp.com> 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:
> > velocity-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > velocity-user-help@jakarta.apache.org
> >
> >
>
>
>
>
>
>
> ___________________________________________________________
> All new Yahoo! Mail "The new Interface is stunning in its simplicity and ease of use."
- PC Magazine
> http://uk.docs.yahoo.com/nowyoucan.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>

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


Mime
View raw message