tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jim Cox" <shakahsha...@gmail.com>
Subject Re: Excess whitespace generated
Date Thu, 10 Jul 2008 17:08:51 GMT
On Thu, Jul 10, 2008 at 12:51 PM, Jonathan Mast <jhmast.developer@gmail.com>
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...>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message