[thelist] can whitespace be removed

Hassan Schroeder hassan at webtuitive.com
Wed Feb 18 18:34:34 CST 2004


/* last night's reply seems to have checked into the Moderation
    Motel, Suspicious Header Suite, so here goes again... */

Diane Soini wrote:

> Is there any way to remove the empty lines of whitespace that are 
> leftover when you include server-side scripts that have a bunch of code 
> in them?

I'm guessing you're using JSP, yes? :-)   If so,

1) get that code out of there in the first place; instead of using
    code snippets in includes, set request-scope variables using one
    or more preceding JSP page/servlet(s) and forward to the "final"
    page for display.

    Ideally, that page will have zero logic in it -- just the output
    of a collection of variables.

2) if you're using taglibs, pay close attention to any loops with
    enclosed line breaks; the placement of <c:set> statements inside
    or outside a <c:forEach> or <c:forTokens> loop can make a *big*
    difference in white space.

3) wrap code blocks in <str:trim> tags; hackey but effective.

But approach #1 will make your project maintenance *so* much easier
that there's really no contest, eh?  :-)

HTH!
-- 
Hassan Schroeder ----------------------------- hassan at webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

                           dream.  code.




More information about the thelist mailing list