There is a trimWhiteSpaces directive that should be able to do this,
Adding this to the jsp-config section your web.xml should do it:
<jsp-config>
<jsp-property-group>
<url-pattern>*.jsp</url-pattern>
<trim-directive-whitespaces>true</trim-directive-whitespaces>
</jsp-property-group>
</jsp-config>
Or adding this to the top of your JSP page is an alternative:
<%@ page trimDirectiveWhitespaces="true" %>
If your servletcontainer doesn't support the JSP 2.1 trimDirectiveWhitespaces property, then you can try adding this to your web.xml file instead:
<init-param>
<param-name>trimSpaces</param-name>
<param-value>true</param-value>
</init-param>