velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathan Bubna" <nat...@esha.com>
Subject Re: (velocity-struts) How to add context in action class?
Date Thu, 20 Mar 2003 02:11:24 GMT
wu qi said:
>      In a non struts app,we can use add method of context:
>
> VelocityContext context = new VelocityContext();
>
> context.put( "name", new String("Velocity") );
>
> but for action class in struts ,how to do that?

just put it in the request attributes:

request.setAttribute("name", "Velocity");

this will have the same effect, because the VelocityViewServlet uses a
ChainedContext that automatically exposes request, session, and servlet
context attributes (among several other things) to the template.

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


Mime
View raw message