velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathan Bubna" <>
Subject Re: This question has "first major web app" written all over it.
Date Fri, 11 Apr 2003 20:59:14 GMT
John said:
> I understand that you don't need to use the HttpSession, but if doing
> web programming and not template processing (though they are one in
> the same mostly) you have to place objects within the HttpSession to
> have them accessible to the VTL?  I hope that last sentence made
> sense....

well, the question seems grammatically correct, but it appears to be based
on a hasty mis-assumption or regrettable misinformation.  you do NOT have to
put objects in the HttpSession attributes to make them accessible in your
template.  that has never been and never will be true.

assuming you are using the VelocityViewServlet, you may also put data in the
application (ServletContext) attributes, the request (HttpServletRequest)
attributes, or make them accessible via any number of arbitrary tools
specified in your toolbox.xml.  in other words, you can make your
data/objects available to your templates in just about any way you darn well
please.  personally, i recommend accessing things via tools in order to
provide a uniform API to your all your templates.  you may still store some
objects in the request, session, or application attributes, but if your tool
implements the ViewTool interface, then your tool can access these objects,
retrieve the data from the request/session/application and then make it
available to the template  (as the velocity-struts tools do).

Nathan Bubna

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

View raw message