You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by VA...@LILLY.COM on 2001/08/22 14:59:16 UTC
suppressing white space in jsps
Is there any way to suppress the whitespace that is output by jsp's in
Tomcat/Catalina? I have a simple jsp that generates a .csv, and sets the
HTTP headers so that it opens in Excel (intranet app). Even with cramming
all the jsp intro stuff on one line, I still end up with one blank line as
the first line of output. (actually, one newline code). I know that
jasper must be converting every newline in the source .jsp to something
like println("\n") in the servlet --- that's what I'd like to turn off
(selectively)
Is this possible?
-jason
Re: suppressing white space in jsps
Posted by David Cassidy <dc...@hotgen.com>.
Would you like to let us see the jsp - we might spot something...
David
Matt Hudson wrote:
>
> The only solution I have heard of is to remove the newline from your
> JSP.
> That's right -- one long line for the entire JSP.
>
> On Wed, Aug 22, 2001 at 07:59:16AM -0500, VASQUEZ_JASON@LILLY.COM wrote:
> > Is there any way to suppress the whitespace that is output by jsp's in
>
> > Tomcat/Catalina? I have a simple jsp that generates a .csv, and sets
> the
> > HTTP headers so that it opens in Excel (intranet app). Even with
> cramming
> > all the jsp intro stuff on one line, I still end up with one blank
> line as
> > the first line of output. (actually, one newline code). I know that
> > jasper must be converting every newline in the source .jsp to
> something
> > like println("\n") in the servlet --- that's what I'd like to turn off
>
> > (selectively)
> >
> > Is this possible?
> >
> > -jason
>
> --
>
> "A weird imagination is most useful to gain full advantage of all the
> features."
>
> matt hudson matt@spaceship.com http://www.spaceship.com/~matt
Re: suppressing white space in jsps
Posted by Matt Hudson <ma...@spaceship.com>.
The only solution I have heard of is to remove the newline from your JSP.
That's right -- one long line for the entire JSP.
On Wed, Aug 22, 2001 at 07:59:16AM -0500, VASQUEZ_JASON@LILLY.COM wrote:
> Is there any way to suppress the whitespace that is output by jsp's in
> Tomcat/Catalina? I have a simple jsp that generates a .csv, and sets the
> HTTP headers so that it opens in Excel (intranet app). Even with cramming
> all the jsp intro stuff on one line, I still end up with one blank line as
> the first line of output. (actually, one newline code). I know that
> jasper must be converting every newline in the source .jsp to something
> like println("\n") in the servlet --- that's what I'd like to turn off
> (selectively)
>
> Is this possible?
>
> -jason
--
"A weird imagination is most useful to gain full advantage of all the features."
matt hudson matt@spaceship.com http://www.spaceship.com/~matt
Re: suppressing white space in jsps
Posted by Johannes Lehtinen <jl...@cc.hut.fi>.
On Wed, 22 Aug 2001 VASQUEZ_JASON@LILLY.COM wrote:
> Is there any way to suppress the whitespace that is output by jsp's in
> Tomcat/Catalina? I have a simple jsp that generates a .csv, and sets the
> HTTP headers so that it opens in Excel (intranet app). Even with cramming
> all the jsp intro stuff on one line, I still end up with one blank line as
> the first line of output. (actually, one newline code).
I have been using two approaches when producing output formats where extra
newlines are not allowed.
Either I leave them inside tags like...
<%@ whatever...
%><%@ whatever..
%>Here goes the first line of output
...or using comments like...
<%@ whatever... %><%--
--%><%@ whatever... %><%--
--%>Here goest the first line of output
I have to admit this is not very elegant so I would be happy to know of
any cleaner alternatives.
--
Johannes Lehtinen <jo...@iki.fi>, http://www.iki.fi/jle/
Re: suppressing white space in jsps
Posted by "Craig R. McClanahan" <cr...@apache.org>.
On Wed, 22 Aug 2001 VASQUEZ_JASON@LILLY.COM wrote:
> Is there any way to suppress the whitespace that is output by jsp's in
> Tomcat/Catalina? I have a simple jsp that generates a .csv, and sets the
> HTTP headers so that it opens in Excel (intranet app). Even with cramming
> all the jsp intro stuff on one line, I still end up with one blank line as
> the first line of output. (actually, one newline code). I know that
> jasper must be converting every newline in the source .jsp to something
> like println("\n") in the servlet --- that's what I'd like to turn off
> (selectively)
>
> Is this possible?
>
Not directly. However, you could write a Filter (using this new feature
of the Servlet 2.3 APIs to do it after the fact).
Or, if you used a servlet instead of a JSP page to create the output, you
would have complete and total control over the formatting.
> -jason
>
Craig