0

When my SpringMVC application send HTML replies to requests there are a large number of consecutive blank lines in the output that appear to correspond with the placement of comments in the JSP file.

Is there a setting to not output those blank lines?

Malcolm O'Hare
  • 4,879
  • 3
  • 33
  • 53

1 Answers1

1

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>
Jack Harkness
  • 810
  • 7
  • 10