First of all, you will always run some risk if you try to redirect from a JSP page. Nevertheless, if the redirect is near the top of the page and your buffer size is of a reasonable size, you should be ok. If you're failing, then you either have a miniscule buffer size, or your redirect element is not near the beginning of the page (or your redirect is in a deeply "include"d page). I wouldn't start worrying about the white space emitted by your tags. If you have to be concerned about that, you have other problems.
> -----Original Message----- > From: Rick Ross [mailto:[EMAIL PROTECTED] > > 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: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
