On Thu, Jul 10, 2008 at 12:51 PM, Jonathan Mast <[EMAIL PROTECTED]>
wrote:

> I'm writing a jsp to return out a simple xml document and it is being
> preceded by quite a few line breaks, causing my test parser to fail.
>
> The page simply calls out.println(xmlstring);
>
> Is there another way to control precisely the contents returned by a JSP?
>
> I thought there would be a "setContent" method in the implicit response
> object, but there isn't.
>

I do the following in my XML-producing JSPs to avoid excess whitespace:

<%
    out.clear() ;
    response.setContentType("text/xml") ;
    response.setHeader("pragma", "no-cache") ;
%><?xml version="1.0" encoding="ISO-8859-1"?>
<...the rest of my XML...>

Reply via email to