背景:在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库)。
解决:According to TLD or attribute directive in tag file, attribute value does not accept any express。
最新推荐文章于 2021-07-15 16:21:32 发布