jsp页面中去除多余空行

jsp页面中使用<%…%>编译后的html页面都会有空行,

解决方法:

1、在每个页面中加入代码:

 <%@ page trimDirectiveWhitespaces="true" %>  支持jsp 2.1 +

2、使用Servlet 2.5 时 可在web.xml中加入以下代码:

<jsp-config>

<jsp-property-group>

<url-pattern>*.jsp</url-pattern>

<trim-directive-whitespaces>true</trim-directive-whitespaces>

</jsp-property-group>

</jsp-config> 
posted @ 2011-07-13 14:24  冗余楠  阅读(569)  评论(0编辑  收藏  举报