Sometimes it would be nice to trim jsp for blank lines. Every JEE developer knows that jsps contains blank lines... lots'n'lots of silly stupid blank lines. But fear not, the solution is as simple as it is elegant. JSP 2.1 supports a new trimWhitespace directive:

<%@ page trimDirectiveWhitespaces="true" %>

You could also add the following to your web.xml:


Notice that you should use a Servlet 2.5 XSD in order for this to work.