Hi,
I too noticed the white space issue. Though it is not in the scale that you described, it is a problem. It has to be addressed as this will certainly be the source of page bloat for unsuspecting people. As a temp fix try using Gzip compression on the pages. This is the sort of thing that I think GZIP can really help with. I use a servlet filter that does this automatically. Stef ----- Original Message ----- From: "Henri Yandell" <[EMAIL PROTECTED]> To: "Tag Libraries Users List" <[EMAIL PROTECTED]> Sent: Wednesday, November 13, 2002 4:17 PM Subject: Re: Whitespace generated by JSTL tags > really stupid answer.... > > but you could try wrapping it all in a string taglib which search and > replaced for whitespace :) > > Hen > > On Wed, 13 Nov 2002, Corby Jacobs wrote: > > > I am investigating an issue with a JSP page which, under certain circumstances, generates a 22.4 MB file to send back to the client. Turns out, a substantial portion of this page is whitespace. As I see it, the whitespace is coming from two places: > > > > 1) whitespace the developer added to make the JSP more readable seems to be repeated in the HTML sent to the client (and duplicated if it's inside a <c:forEach> tag) > > > > and > > > > 2) the tags themselves are generating extra newline characters > > > > To address issue 1, I edited the JSP file, changed all tabs to one blank space, and removed all empty lines. This reduced the size of the file from 22.4MB to 4.1MB. Then, within the triple-nested <c:forEach> loops, I made the code all one line -- very ugly, but reduced the size of the HTML file to 367kB. > > > > To confirm my suspicions on issue 2, I re-wrote a small excerpt of the page to use scriptlets instead of <c:forEach> and <c:if> tags. The loop is used to generate a <select> with <option>s whose value depend on the iteration through the loop. As you can see in the excerpt from the "view page" source sent to the client, the version generated with the core JSTL tags has extra whitespace between the <option>s. Imagine doing this for a menu of 100 <option>s, 3 times, and you can see where all the whitespace is coming from. I tested this with both Tomcat and Weblogic as the web server. > > > > My question is this: Is there any way to avoid all this whitespace caused by core JSTL tags? > > > > > > > > <table> > > <tr> > > <td align="left" bgcolor="#ffffff"> > > This selection menu was generated using standard JSTL tags <c:if>, <c:forEach>, and <c:out>. > > </td> > > </tr> > > <tr> > > <td align="left" bgcolor="#ffffff"> > > <select name="termselector"> > > > > > > > > <option value="wordNode_1" testID="option_wordNode_1" > > > HELP > > </option> > > > > > > > > <option value="wordNode_2" testID="option_wordNode_2" > > > USER > > </option> > > > > > > > > <option value="wordNode_3" testID="option_wordNode_3" > > > WRITE > > </option> > > > > > > > > <option value="wordNode_4" testID="option_wordNode_4" > > > QUERY > > </option> > > > > > > </select> > > </td> > > </tr> > > <tr> > > <td align="left" bgcolor="#ffffff"> > > This selection menu was generated using scriptlets instead of standard JSTL tags. > > </td> > > </tr> > > <tr> > > <td align="left" bgcolor="#ffffff"> > > <select name="termselector"> > > > > <option value=wordNode_1 testID=option_wordNode_1 > > > HELP > > </option> > > > > <option value=wordNode_2 testID=option_wordNode_2 > > > USER > > </option> > > > > <option value=wordNode_3 testID=option_wordNode_3 > > > WRITE > > </option> > > > > <option value=wordNode_4 testID=option_wordNode_4 > > > QUERY > > </option> > > > > </select> > > </tr> > > </td> > > </table> > > > > > > Thanks, > > > > Corby Jacobs > > [EMAIL PROTECTED] > > Convera Corporation > > 11000 Broken Land Pkwy > > Columbia, MD 21044 > > > > -- > > To unsubscribe, e-mail: <mailto:taglibs-user-unsubscribe@;jakarta.apache.org> > > For additional commands, e-mail: <mailto:taglibs-user-help@;jakarta.apache.org> > > > > > > > -- > To unsubscribe, e-mail: <mailto:taglibs-user-unsubscribe@;jakarta.apache.org> > For additional commands, e-mail: <mailto:taglibs-user-help@;jakarta.apache.org> > -- To unsubscribe, e-mail: <mailto:taglibs-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:taglibs-user-help@;jakarta.apache.org>