| ||||||||||||||||||
Why I am getting extra whitespace in the output of my JSP?I'm getting a lot of whitespace in my JSP that I don't intend to be there. Why is it appearing and how can I get rid of it? The extra whitespace is coming from newlines, often at the end of declaration lines at the beginning of the JSP. For example, the following jsp:
Has newlines in these locations:
The result contains the newlines, which may be surprising:
One solution is to let the JSP tag extend across the newline:
Another solution is to use JSP comments to remove the newlines:
Another solution is to use the XML syntax of JSP. Parsing of XML causes removal of extra whitespace.
Resin also supports the use of the '\' character to eat whitespace (this is a Resin specific feature):
|