JSP custom tags and whitespace issue
Has anyone encountered this problem? I have been writing JSPs with custom tags and JAVA's Standard taglib tags. When the page is rendered in the browser, I notice a LOT of whitespace. It doesn't bother with the look and feel or anything, but it does increase the size of the HTML file and affects performance (nothing significant, but still a factor).
I am trying to reduce the amount of whitespace. Is there something that can be done in the code/servlet/jsp to reduce generating tons of whitespace in the HTML file?
Thanks.
-- Ankur
The whitespace is coming directly from the JSP. If you put a blank line in there, or indent it, or even start a tag on a new line, all that whitespace is faithfully copied to the response. So you can remove that sort of whitespace from your JSP code easily. If your taglibs are generating whitespace in the same way, there is not much you can do about that.
I have noticed that scriptlets sometimes leave whitespace in the page (where the java code was) but that doesnt sound like this is what you're talking about...are there any fixes for this problem? Not that it really bothers me that much...
Also, to be honest, I wouldn't worry too much about overhead from whitespace...its more an issue of whether or not whitespace bothers you as a person, because it's probably only a matter of a few characters in ASCII (or whatever it's transferred as), which boils down to a few bytes.
Laz