There is a trimWhiteSpaces directive that should accomplish this,
In your JSP:
<%@ page trimDirectiveWhitespaces="true" %>
Or in the jsp-config section your web.xml (Note that this works starting from servlet specification 2.5.):
<jsp-config>
<jsp-property-group>
<url-pattern>*.jsp</url-pattern>
<trim-directive-whitespaces>true</trim-directive-whitespaces>
</jsp-property-group>
</jsp-config>
Unfortunately if you have a required space it might also need strip that, so you may need a non-breaking space in some locations.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…