You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Rick Ross <rr...@stupendousman.com> on 2003/06/30 22:36:32 UTC
Whitespace Galore!
Hi all,
I've been running into two little oddities that I thought might be worth
some discussion.
1. I was not able to redirect a page based on a JSTL condition tag (c:if,
c:choose, etc.) because the tags themselves would invariably pump some
\r\n's into the page. This of course, caused a commit on the output stream
which disallowed any redirect actions. So basically something like
<c:if test="${true}">
<c:redirect url="otherplace.html" />
</c:if>
Will never redirect.
Now, remember that the code above is actually the same as :
<c:if test="${true}">[crlf][space][space][space]<c:redirect
url="otherplace.html" />[crlf]
</c:if>[crlf]
Even so, if leave you out the extra whitespace, like so:
<c:if test="${true}"><c:redirect url="otherplace.html" /></c:if>
It will still fail. taking a look at the _jsp.java file shows the culprit.
Very early on, a \r\n combo gets written to the output stream. Naturally, I
have buffering set and autoFlush off.
Of course there are a dozen ways around this, so it's no big deal, but I
doubt that it is intentional and extra whitespace is my second point.
2. There is a ton of whitespace all over my output. Many many newlines ...
so many, that it is hard to examine the source of the output. I think that
most of it is in the bodies of conditionals... anyone else having
problems?
Rick Ross
"Any sufficiently complex technology is indistinguishable from
garbage"
---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
Re: Whitespace Galore!
Posted by Neil Zanella <nz...@cs.mun.ca>.
On Mon, 30 Jun 2003, Rick Ross wrote:
> 2. There is a ton of whitespace all over my output. Many many newlines ...
> so many, that it is hard to examine the source of the output. I think that
> most of it is in the bodies of conditionals... anyone else having
> problems?
Yes!!! This is the one feature I miss the very most about PHP tags, which,
are such that an entire line enclosed within <?php /* ... */ ?> will be
stripped off together with the newline character that follows it for
pretty output! I really cannot understand why JSP doesn't do this
and hope that this will change in the future:
Q: How can you tell a page is written with JSP?
A: If when you view page source in your web browser you see that there are
a lot of runs of consecutive blank lines! It looks sloppy!!! ... and is
unfriendly and makes the output hard to debug and read!
There must be a way around it; there must, otherwise JSP sucks.
So how can it be achieved?
Regards,
Neil
---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org