欢迎访问悦橙教程(wld5.com),关注java教程。悦橙教程  java问答|  每日更新
页面导航 : > > 文章正文

jsp开发的网页如何避免html头上的大段空白,jsp开发html头上,默认情况下jsp页面输出

来源: javaer 分享于  点击 38111 次 点评:136

jsp开发的网页如何避免html头上的大段空白,jsp开发html头上,默认情况下jsp页面输出


默认情况下jsp页面输出的html页面中有很多行的空白,可以通过设置pagetrimDirectiveWhitespaces属性来避免这些空白:

如下jsp page指令设置:

<%@ page trimDirectiveWhitespaces="true" %>

或者你也可以在配置文件web.xml中配置一下,这样项目中的所有页面都不需要设置这个属性了

<jsp-config>  <jsp-property-group>    <url-pattern>*.jsp</url-pattern>    <trim-directive-whitespaces>true</trim-directive-whitespaces>  </jsp-property-group></jsp-config>
相关栏目:

用户点评