<%@ page trimDirectiveWhitespaces="true" %>
来源:互联网 发布:电信卡的网络模式 编辑:程序博客网 时间:2024/05/04 01:52
我们经常会在JSP页面上使用:
<%@ page trimDirectiveWhitespaces="true" %>
这个命令可以使jsp输出的html时去除多余的空行(jsp上使用EL和tag会产生大量的空格和空行)。
但是这个命令是从JSP2.1规范以后才得到支持。
所以在tomcat 6.0之前的版本上如果使用这个命令就会抛出异常:
Page directive has invalid attribute: trimDirectiveWhitespaces
解决方法是:
1.升级tomcat至6.0以上版本
2.Tomcat 5.5.x+,不要使用trimDirectiveWhitespaces,改用这种方法:
在Tomcat安装目录/conf/web.xml中找到名叫"jsp"的servlet,添加下面一段代码:
<init-param>
<param-name>trimSpaces</param-name>
<param-value>true</param-value>
</init-param>
<param-name>trimSpaces</param-name>
<param-value>true</param-value>
</init-param>
查看JSP版本可以使用下面的命令:
JSP version: <%= JspFactory.getDefaultFactory().getEngineInfo().getSpecificationVersion() %>
更多信息可以参考:
http://blog.csdn.net/xuhaiyang/archive/2008/05/23/2472591.aspx
- <%@ page trimDirectiveWhitespaces="true" %>
- <%@ page trimDirectiveWhitespaces="true" %>
- JSP JSTL EL 删除空行 <%@ page trimDirectiveWhitespaces="true" %>
- JSP JSTL EL 删除空行 <%@ page trimDirectiveWhitespaces="true" %>
- jsp trimDirectiveWhitespaces ="true"
- jsp trimDirectiveWhitespaces ="true"
- jsp trimDirectiveWhitespaces ="true"(删除空白行)
- <%@ page isThreadSafe="true|false" %>
- $page = $_GET['page'] 和 empty($page) 返回 true
- 异常处理:Page directive has invalid attribute: trimDirectiveWhitespaces
- <%@ Page EnableEventValidation="true" %> asp:DataList OnItemCommand=
- asp.net2.0技术详解Page EnableEventValidation="true"
- jsp:include page="filename" flush="true"之flush="true"解释
- <jsp:include page="" flush="true" /> 中flush="true 的作用
- <%@ page include=""%> 和<jsp:include flush="true" page=""></jsp:include>两者的区别
- ueditor-tomca6以下报错:Page directive has invalid attribute: trimDirectiveWhitespaces
- <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="EmptyProjectNe
- <%@ include file=”url”%> 和<jsp:include page=”url” flush=”true” /> 的区别
- android lunch 分析
- fractal modeling of natural terrain: analysis and surface reconstruction with range data
- Linux pthread_mutex_init()函数
- gcc动态链接库基本知识
- 解剖JavaScript中的null和undefined
- <%@ page trimDirectiveWhitespaces="true" %>
- 秒杀多线程第六篇 经典线程同步 事件Event .
- 详解个人博客的创建
- java 日期转换
- linux下动态链接问题(so文件的编写与调用)
- 业务人员和技术人员之前桥梁的角色
- FCKeditor本地test.html
- 想离职,我们需要做什么
- ACE Reactor 处理信号