1. 程式人生 > >解決:According to TLD or attribute directive in tag file, attribute value does not accept any express。

解決:According to TLD or attribute directive in tag file, attribute value does not accept any express。

背景:在MySQL中有一個欄位宣告為datetime型別,在用hibernate對映時對應的型別為Java.util.Date。因此從資料庫中讀出來,在前臺jsp頁面顯示時,日期格式為年月日,時分秒,毫秒,例1986:07:26 09:07:21 0。日期在實體類和對映檔案中已經宣告為java.util.Date型別。
   還有一種就是我查找出來日期型別的屬性然後用<fmt:formatDate value="${off.firstTime}" type="date"來進行格式化,但是卻報錯了,也是一下這種原因,

現有2中解決的辦法
查詢之後得到的解決辦法有兩種:

 一、在page指令裡,加入isELIgnored="true"
屬性,即 <%@ page language="java" contentType="text/html;charset=gbk" isELIgnored="true" %>這個是忽略EL表示式,雖然可以解決問題,但其他處的EL表示式會被當做字串輸出,不建議使用。 二、把<%@ taglib prefix="c" uri="http://java.sun.com/jstl/fmt" %>變為: <%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt_rt"%> <%@ taglib prefix="c"
uri="http://java.sun.com/jstl/core"%> 原理(摘抄):應用部署執行的時候出現JSP異常, 發生在使用JSTL庫的時候: According to TLD or attribute directive in tag file, attribute value does not accept any expressions,可能是因為使用了JSP2.0版本, 同時又沒有使用JSTL core庫的備用版本(RT庫)。