velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jonas Bengtsson" <jona...@home.se>
Subject RE: Multiple templates in servlets
Date Fri, 02 Nov 2001 00:26:35 GMT
Yes you have understood me correctly.
Would it require much rework?

One thing would be to reduce the number of files.
Another problem with a single template is, for instance, when one has a
plug-in page:
* each plug-in will generate some output to the page
* there is no way of knowing which plug-ins there are
If there would be a parseTemplate() method one could do like this:
parseTemplate(getTemplate("header.vm"));
for(int i=0;i<plugIns.length;i++) {
   parseTemplate(plugIns[i].generateTemplate(context));
}
parseTemplate(getTemplate("footer.vm"));

or something like that...
But how should this be solved with a single template?

Thanks is advance,
Jonas Bengtsson


> -----Original Message-----
> From: Geir Magnusson Jr. [mailto:geirm@optonline.net]
> Sent: Friday, November 02, 2001 12:52 AM
> To: velocity-user@jakarta.apache.org
> Subject: Re: Multiple templates in servlets
>
>
> On 11/1/01 6:45 PM, "Jonas Bengtsson" <jonas.b@home.se> wrote:
>
> > Hi,
> > <newbie-quiestion-alert>
> > Is it possible to use several templates in one servlet. For
> instance if I
> > have three templates called: header.vm, content.vm and footer.vm. Is it
> > possible to use all these templates from the servlet, i.e. not
> with #parse
> > directives.
> > </newbie-question-alert>
>
> If I understand what you mean - to not use something like a
> 'frame' template
> like
>
> #parse("header.vm")
> #parse("content.vm")
> #parse("footer.vm")
>
> Then you can actually render each individually into the output
> stream.  The
> included Velocity servlet isn't designed for this - you will have
> to modify
> or roll your own, but yes, it's possible.
>
> Can I ask why you want to do this?
>
> Geir
>
> --
> Geir Magnusson Jr.                                     geirm@optonline.net
> System and Software Consulting
> "They that can give up essential liberty to obtain a little
> temporary safety
> deserve neither liberty nor safety." - Benjamin Franklin
>
>
>
> --
> To unsubscribe, e-mail:
<mailto:velocity-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:velocity-user-help@jakarta.apache.org>



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


Mime
View raw message