velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Bubna <>
Subject Re: session object in velocity with velocity-tools
Date Fri, 16 Jul 2004 16:38:29 GMT
Mike Curwen said:
> using velocity tools doesn't magically transform the context into a
> session-level storage space.  If you put something in the Context, then
> it is limited to a single request. just think to yourself "context ==
> request".


> If you specifically need something in the session, then don't forget
> that Velocity works and plays *very* well with existing servlet API
> objects, like 'HttpSession' and 'ServletContext' (also known as
> 'application').
> In your servlet, do :
> session.setAttribute("foo", fooObject);
> then in your velocity template do:
> $session.getAttribute('foo')

actually, if you are using the VelocityViewServlet, then you can just do


and it will find the session attribute.  but you must still put "foo" into the
session yourself in one of the ways i spelled out in previous emails.

Nathan Bubna

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

View raw message