velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Will Glass-Husain" <wglasshus...@gmail.com>
Subject Re: alternate solution for developer who want to use include VM file
Date Mon, 04 Jun 2007 16:06:48 GMT
Hi Praveen,

(ccing the user list-- better place for such items -- please respond there).

Thanks for sharing this bit of code.  Can you explain it a little more?  Is
it intended to be used by a Velocity user when calling Velocity? Or are you
suggesting this code be included in the library itself?  (if so, where).

If you are hoping to share this with other Velocity users, a great place to
do so is our wiki.  ( wiki.apache.org/velocity ).  There's a section for
contributed code. Putting this snippet there will help it to be permanent;y
available rather than just a transient message on a mail list.

Thanks again.

WILL

On 6/4/07, Mishra, Praveen <Praveen.Mishra.ctr@sabre.com> wrote:
>
>  Hi,
>
>
>
> Please find code that can be used as alternate solution for developer who
> want to use include file macro in main velocity file.
>
>
>
> Include file can be put in flat file as comma separated and loaded on
> demand as per main vm page request.
>
>
>
> This also saves a lot of memory as compare to putting all include vm file
> at start up in global library at a time.
>
>
>
> *try*
>
>             {
>
>                   *if*(includeVMFiles != *null*)
>
>                   {
>
>                     st = *new* StringTokenizer(includeVMFiles,",");
>
>                      *while* (st.hasMoreTokens())
>
>                      {
>
>                          template = Velocity.*getTemplate*(st.nextToken
> ());
>
>
>
>                      }
>
>                   }
>
>                 template = Velocity.*getTemplate*(vmTemplate);
>
>             }
>
>             *catch*( ResourceNotFoundException rnfe )
>
>             {
>
>                   *logger*.log(Level.*WARNING*, "cannot find template ",
> rnfe);
>
>
>
>             }
>
>
>
>
>
> Regards
>
> Praveen Misra
>



-- 
Forio Business Simulations

Will Glass-Husain
wglass@forio.com
www.forio.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message