Silly? I disagree. Filters are about more than removing whitespace.
I want the whitespace when I'm developing, because readability and understanding is very important to me. When I use a filter, I can keep the whitespace when I develop and remove it when it really matters - when sending a minimal byte response to a client. At all other times I want to keep it around. All this thrashing to remove it seems sillier to me than filters. The GZip compression filter that I wrote is 119 lines of code, including explicit imports for each class, comments, whitespace, and putting curly braces on their own line. Once I've written it, I can reuse it all over the place by simply adding it to my web.xml. What's the big deal? --- Neil Zanella <[EMAIL PROTECTED]> wrote: > > Despite the solutions presented here I think JSPs > should do stuff > like PHP does it (much easier than having to install > filters, seems > kind of silly to install a filter just to remove > whitespace). Right > now I am doing the following, which is not great > either: > > <p><%-- > --%><c:out value="foo1" /><%-- > --%><c:out value="bar1" /><%-- > --%><c:out value="foo2" /><%-- > --%><c:out value="bar2" /> > </p> > > But at least it's a little cleaner than cramming all > tags together. (?) > > Regards, > > Neil > > On Tue, 8 Jul 2003, Michael Duffy wrote: > > > > > Hi Eric, > > > > Thanks for the links to these. I wasn't aware of > > either. > > > > Marty Hall's "More Servlets and JSPs" has a nice > > chapter on filters. I went through that to get > the > > source that I'm running. It was a fine learning > > experience for me. > > > > But perhaps the stuff you're citing is more > > bulletproof. Thanks for the links. - MOD > > > > > > --- [EMAIL PROTECTED] wrote: > > > I was going to program some Servlet filters when > I > > > saw the following: > > > http://www.servletsuite.com/servlets/trimflt.htm > > > http://www.servletsuite.com/servlets/gzipflt.htm > > > > > > This might do all you ever wished for :-) > > > > > > I'll install it here and keep you posted... > > > > > > Best regards, > > > Eric > > > > > > -----Original Message----- > > > From: Michael Duffy [mailto:[EMAIL PROTECTED] > > > Sent: Montag, 7. Juli 2003 21:15 > > > To: Tag Libraries Users List > > > Subject: Re: removing those blank lines from the > > > output > > > > > > > > > I guess you can do that, but I prefer something > > > else. > > > > > > I use a GZIP compression filter on my control > > > servlet > > > that gets rid of all that extraneous whitespace > and > > > more when I sent responses back to clients that > can > > > accept compressed output. > > > > > > That's what eBay does routinely. > > > > > > I'm seeing good compression in the response. I > log > > > before & after stream size, just to check. > Fewer > > > bytes on the wire means faster response, as long > as > > > the compression and decompression times are > small > > > compared to transmission time. My subjective > > > measure > > > tells me that response is pretty fast, but I > have to > > > admit that I don't have hard "before and after" > > > numbers. > > > > > > I agree with your aim, but I disagree with the > way > > > you > > > achieve it. Respectfully yours, MOD > > > > > > --- Yann Cébron <[EMAIL PROTECTED]> wrote: > > > > > > > > "Michael Duffy" <[EMAIL PROTECTED]> schrieb im > > > > Newsbeitrag > > > > > > > > > > news:[EMAIL PROTECTED] > > > > > > > > > > Sorry, but I thought the question had to do > with > > > > > getting rid of whitespace from JSPs > generated at > > > > > runtime. Perhaps I lost the thread. - MOD > > > > > > > > > > > > > Actually, since all your JSP-tags and > HTML-tags > > > will > > > > be side by side in your > > > > JSP-source you'll save a lot of whitespace, > > > > especially when using > > > > <c:forEach> or similar constructs. At least it > > > saved > > > > me about 50-80% of the > > > > resulting HTML, depending on the original JSP. > > > > > > > > Try it out for yourself to see if it does the > job > > > > for you... > > > > > > > > Cheers, > > > > Yann > > > > > > > > > --- Yann Cébron <[EMAIL PROTECTED]> wrote: > > > > > > Hi, > > > > > > > > > > > > here's a snippet I use in my build.xml > after > > > > copying > > > > > > the JSPs and HTML files > > > > > > to the build dir: > > > > > > > > > > > > <replaceregexp match=">\s*<" > > > > > > replace="><" flags="g" > > > > > > byline="false"> > > > > > > <fileset dir="${build.home}" > > > > > > includes="**/*.html,**/*.htm,**/*.jsp"/> > > > > > > </replaceregexp> > > > > > > > > > > > > This is not a perfect solution, but it > gets > > > you > > > > a > > > > > > *very* compact HTML output > > > > > > and it does not have any runtime-costs > like > > > e.g. > > > > > > Servlet-filters or other > > > > > > tags which strip the whitespace *after* > the > > > > response > > > > > > has been generated. > > > > > > > > > > > > HTH, > > > > > > Yann > > > > > > > > > > > > "Neil Zanella" <[EMAIL PROTECTED]> > schrieb im > > > > > > Newsbeitrag > > > > > > > > > > > > > > > > > > > > > news:[EMAIL PROTECTED] > > > > > > > > > > > > > > Hello, > > > > > > > > > > > > > > Is there really no NEAT way of removing > > > those > > > > > > blank lines left over from > > > > > > > JSP tags in the output??? I'm shocked!!! > > > :-() > > > > > > > > > > > > > > Thanks! :-) > > > > > > > > > > > > > > Neil > > > > > > > > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > To unsubscribe, e-mail: > > > > [EMAIL PROTECTED] > > > > For additional commands, e-mail: > > > > [EMAIL PROTECTED] > > > > > > > > > > > > > __________________________________ > > > Do you Yahoo!? > > > SBC Yahoo! DSL - Now only $29.95 per month! > > > http://sbc.yahoo.com > > > > > > > > > --------------------------------------------------------------------- > > > 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] > > > > > > > > > __________________________________ > > Do you Yahoo!? > > SBC Yahoo! DSL - Now only $29.95 per month! > > http://sbc.yahoo.com > > > > > --------------------------------------------------------------------- > > 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] > __________________________________ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]