[prev in list] [next in list] [prev in thread] [next in thread] 

List:       velocity-user
Subject:    Re: generating a csv file with no html headers
From:       Shinobu Kawai <shinobu.kawai () gmail ! com>
Date:       2004-11-25 7:06:36
Message-ID: 20041125155702.4692.SHINOBU.KAWAI () gmail ! com
[Download RAW message or body]


Hi Ilan,

> I have a layout that contains one line:
> $screen_placeholder
> 
> Also, I have a corresponding .vm file that contains the following:
> #foreach ( $result in $results )
>   $result.getFName(),$result.getLName()
> #end
> 
> When I request the vm through a browser I get a page with the following
> source code:
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
> "http://www.w3.org/TR/REC-html40/loose.dtd">
> <html><head><title></title></head><body>
> FName1,LName1FName2,LName2FName3,LName3
> </body></html>

That's odd.  Maybe your browser is putting in all those html tags.

> This is not what I want. I am looking to generate a very plain csv file with
> the following source code:
> FName1,LName1
> FName2,LName2
> FName3,LName3
> 
> That is, a file with no html headers, but one that contains some type of
> linefeed/carriage return characters to separate the lines.
> 
> It is also acceptable for me to get a request from the browser to "save" the
> file to disk when the url is requested.
> 
> Any ideas on how to achieve my requirements?

Try changing the content-type.  It _might_ work.  Also, if you just want
to use Velocity, VelocityViewServlet might be better to do general HTTP
handling.

Best regards,
-- Shinobu Kawai

--
Shinobu Kawai <shinobu.kawai@gmail.com>


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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic