You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Ni...@sdk.sas.com on 2002/05/15 14:49:41 UTC

RE: Streaming text contents when using Velocity for HTML templati ng.

If this can't be done (I think it should be something one should be able
to), 
then JSP has something to provide (which is important for high performance
reporting of large
data, and a in a lot of other scenarios, where encapsulated beans are used),

that can't be handled by Velocity.
This cracks the surface of replacing JSP with Velocity, and then also Jon
Stevens evagilizing 
against JSP in favour of Velocity.

NEKO

-----Original Message-----
From: Geir Magnusson Jr. [mailto:geirm@adeptra.com]
Sent: 14. maj 2002 20:24
To: velocity-user@jakarta.apache.org
Subject: Re: Streaming text contents when using Velocity for HTML
templating.


On 5/14/02 1:50 PM, "Nikolaj.Brinch.Joergensen@sdk.sas.com"
<Ni...@sdk.sas.com> wrote:

> 
> Hi,
> 
> I'm doing an app. where I have som context objects that potentially
produce
> very large outputs (data tables).
> I wonder if there is any way I can stream those objects back, so I don't
> have to create a BIG string object on the server (100-1000 of users, and
the
> server will suffer from having to create this in RAM for every user).
> 
> I know that I can do this with JSP, but I really don't want to go down
that
> path, as Velocity is a much cleaner approach to dynamic page generation.
> Actually my context objects are beans that implements a method
> 
> public void write(java.io.Writer out);
> 
> Which make the bean stream to the Writer.

Hm.  You might be able to get away with this.  Put the writer itself into
the context

  context.put("writer", writer);


  $foo.write($writer)


Maybe...

-- 
Geir Magnusson Jr.
Research & Development, Adeptra Inc.
geirm@adeptra.com
+1-203-247-1713



--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Streaming text contents when using Velocity for HTML templating.

Posted by Bill Boland <bo...@attbi.com>.
I gave it a whirl, Geir. It *did* work just fine.

I placed my Foo object with the write method as a request attribute.
I did have to make the changes to the VelocityServlet that I stated
yesterday so that I had an opportunity to place the writer into the
context before the merge.

Here's my template:

#set ( $foo = $req.getAttribute( "foo" ) )
<html>
<body>
Hello, World!<BR>
$foo.write( $writer )
</body>
</html>



-----Original Message-----
From: Geir Magnusson Jr. [mailto:geirm@adeptra.com] 
Sent: Wednesday, May 15, 2002 11:28 AM
To: velocity-user@jakarta.apache.org
Subject: Re: Streaming text contents when using Velocity for HTML
templati ng.

On 5/15/02 8:49 AM, "Nikolaj.Brinch.Joergensen@sdk.sas.com"
<Ni...@sdk.sas.com> wrote:

> 
> If this can't be done (I think it should be something one should be
able
> to), 
> then JSP has something to provide (which is important for high
performance
> reporting of large
> data, and a in a lot of other scenarios, where encapsulated beans are
used),

It *should* work just fine.  Have you tried it?


-- 
Geir Magnusson Jr.
Research & Development, Adeptra Inc.
geirm@adeptra.com
+1-203-247-1713



--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Streaming text contents when using Velocity for HTML templati ng.

Posted by "Geir Magnusson Jr." <ge...@adeptra.com>.
On 5/15/02 8:49 AM, "Nikolaj.Brinch.Joergensen@sdk.sas.com"
<Ni...@sdk.sas.com> wrote:

> 
> If this can't be done (I think it should be something one should be able
> to), 
> then JSP has something to provide (which is important for high performance
> reporting of large
> data, and a in a lot of other scenarios, where encapsulated beans are used),

It *should* work just fine.  Have you tried it?


-- 
Geir Magnusson Jr.
Research & Development, Adeptra Inc.
geirm@adeptra.com
+1-203-247-1713



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>