velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Bubna <>
Subject Re: setting variables with VelocityLayoutServlet
Date Fri, 16 Jul 2004 16:48:41 GMT
Charles N. Harvey III said:
> I was wondering about setting global variables in my templates when
> I am using the VVS.  If I do a #set( $myVar = "thing" ) in my layout.vm
> page, that variable does not show up in the page that is called up in
> the $screen_content.  Is there a way to do this?  Is there a #global
> directive?

layout.vm?  $screen_content?  it sounds like you're using the VLS, not the
VVS.  :)

the thing to remember about the VelocityLayoutServlet is that the screen
template ($screen_content) is processed first.  so anything that it sets in
the context is available to the layout template, but not vice versa.  anything
that happens in the layout template happens after the screen processing is
already over.  so the simple answer is "no."

however, it is possible (and quite easy) to make variables available to both
layout and screen before either of them is processed, because anything made
available to the screen is available to the layout as well.

and there's always the application-wide way to specify global variables in the

<data type="string">

Nathan Bubna

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

View raw message