velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gagan 007 <gagan007in...@yahoo.com>
Subject Re: Same context two merge into diff. Templates, Is this possible in single call to Velocity.evauate?
Date Sat, 12 Mar 2005 14:29:12 GMT
thanx Simon for taking out time to help me

Simon Christian <simon@stoutstick.com> wrote:Ok, in that case the answer to your original
question is essentially no, 
there's no way to do what you're asking in a single pass.

The optimal way to do it would be to use a single context. If the first 
template might make changes to the second template, wrap the single 
context in an individual one per template. Then, if you're going to be 
using the same templates more than once in the application run, it will 
be much more efficient to use mergeTemplate than evaluate, as the former 
uses caching.

hth,

- simon

Gagan 007 wrote:

> Simon, 
> Thanx for ur reply
> Let me try again to explain my need
> 
> 1. I have two different Velocity Templates...
> 2. The Vecloity variables are same in both the templates.
> 3. Now i need to call Velocity.evaluate twice, to merge the context with the templates
> 4. What i m looking for is a way in which i am able to pass both the templates together
with the same context, and two different outputs (one for each template)
> 
> i hope i m clear this time
> 
> 
> Simon Christian wrote:
> Hi Gagan,
> 
> Well it depends what you're asking: do you need to merge two separate 
> templates into two separate outputs? If so then there really isn't a 
> useful way to do this any easier. However, if you need to include the 
> two templates into one output then it's easy, just use #parse() - see 
> the manual for how to use it.
> 
> - simon
> 
> 
> Gagan 007 wrote:
> 
>>Hi 
>>I have populated the VeclocityContext and i have to merge with two templates....
>>
>>i need to call Velocity.evaluate twice for that... 
>>
>>To improve the performace is there any way so that i m able to do this in one single
call
>>
>>- Thanx
>>
>>
>>
>>
>>
>>
>>---------------------------------
>>Do you Yahoo!?
>>Yahoo! Small Business - Try our new resources site! 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> 
> 
> 
> 
> ---------------------------------
> Do you Yahoo!?
> Yahoo! Small Business - Try our new resources site! 

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message