解决:According to TLD or attribute directive in tag file, attribute value does not accept any express。
http://blog.csdn.net/lzblog/article/details/22076893
——————————————————————————————————————————————————————————
背景:在mysql中有一个字段声明为datetime类型,在用hibernate映射时对应的类型为java.util.Date。因此从数据 库中读出来,在前台jsp页面显示时,日期格式为年月日,时分秒,毫秒,例1986:07:26 09:07:21 0。日期在实体类和映射文件中已经声明为java.util.Date类型。
实体类代码:
- public Date startTime;
- public Date closeTime;
hibernate关于这两个字段的映射代码:
- <property name="costTime" type="integer">
- <column name="CostTime" length="50" not-null="true" />
- </property>
- <property name="startTime" type="java.util.Date">
- <column name="StartTime" length="50" not-null="true" />
- </property>
最开始用<s:property value="startTime"></s:property>得出的时间比较怪,是:99-2-26 4:22:50.000
而用el表达式${startTime}得出的时间是1999-02-26 04:22:50.0。
而我想要的时间格式是1999-02-26 04:22:50。
因此用到了jstl标签里的<fmt:formatDate>格式如下:<fmt:formatDate pattern="yyyy:mm:dd HH:mm:ss" value="${startTime}"></fmt:formatDate>
然而报了异常:According to TLD or attribute directive in tag file, attribute value does not accept any expressions
查询之后得到的解决办法有两种:
一、在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库)。
最终页面首部:
- <%@ page language="java" contentType="text/html; charset=UTF-8"
- pageEncoding="UTF-8" %>
- <%@ taglib prefix="s" uri="/struts-tags"%>
- <%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt_rt"%>
- <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%>
输出时使用:
- <fmt:formatDate pattern="yyyy:mm:dd HH:mm:ss" value="${startTime}"></fmt:formatDate>
注:startTime代表本案例中使用的字段名。
用到的JSTL的jar包:jstl.jar和jstl-standard.jar。下载地址:http://jarfiles.pandaidea.com/。
解决: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 expressions
1.错误描写叙述 2014-7-13 17:27:21 org.apache.jasper.compiler.TldLocationsCache tldScanJar 信息: At least one ...
- 使用jstl报错:According to TLD or attribute directive in tag file, attribute value does not accept any expressions
使用jstl报错:According to TLD or attribute directive in tag file, attribute value does not accept any ex ...
- According to TLD or attribute directive in tag file, attribute items does not accep t any expressions
According to TLD or attribute directive in tag file, attribute items does not accep t any expression ...
- 使用jstl标签报错:According to TLD or attribute directive in tag file, attribute value
原来jstl标签版本不一样,标签支持不一样. jstl1.0标签库不支持表达式,如: <c:if test="${query01 == null}"> <js ...
- SSH项目中使用struts-tags报错According to TLD or attribute directive in tag file, attribute test does not accept any expressions
在运行struts2标签页面时报错,代码如下:<%@ page language="java" pageEncoding="gbk"%><%@ ...
- 错误处理——According to TLD or attribute directive in tag file, attribute test does not accept any expres
应用部署运行的时候出现JSP异常, 发生在使用JSTL库的时候: According to TLD or attribute directive in tag file, attribute valu ...
- According to TLD or attribute directive in tag file, attribute test does not accept any expressions
HTTP Status 500 - /WEB-INF/views/emp/list.jsp (line: 30, column: 4) According to TLD or attribute di ...
- According to TLD or attribute directive in tag file, attribute end does not accept any expressions
问题描述: 在 JSP 页面中使用 JSTL 标签库,访问 JSP 页面时抛出了如下异常信息: org.apache.jasper.JasperException: /WEB-INF/manageUs ...
- 终极解法According to TLD or attribute directive in tag file, attribute select does not accept any expressions
3天硬是是把这个问题解决了 有时候突然上个厕所灵感就来了 第一次向用JSTL解析xml 然后我想遍历整个xml文档打印出来 居然不让我输入变量 那让我怎么办啊 在网上各种找答案 说什么<%@ t ...
随机推荐
- 幽灵漏洞(Ghost gethost)
幽灵漏斗简介: 编号CVE-2015-0235的GHOST(幽灵)漏洞是Qualys研究员发现的一个Linux服务上非常严重的安全漏洞,可以被利用来远程代码执行及本地权限提升. 漏洞简要描述 该漏洞存 ...
- CentOS 7 安装以及配置
http://blog.csdn.net/qzc295919009/article/details/42708653
- PhotoShop CS6学习笔记
学习目的是能够处理正常的数码照片,稍作修饰即可.高级功能不做要求.但笔记还是要做的,以后翻翻可以加深记忆. 对于平面设计来说,软件是基础,创意是灵魂. 1. 位图与矢量图 位图,又称为点阵图像或绘制图 ...
- 【Unity】第12章 导航网格和寻路
开发环境:Win10.Unity5.3.4.C#.VS2015 创建日期:2016-05-09 一.简介 NavMesh(导航网格)是3D游戏世界中用于实现"动态"物体自动寻路的一 ...
- Java 格式化数字
; ){ DecimalFormat df = "); String xs = df.format(x); System.out.println(xs); x++; } 将 1 格式化为 0 ...
- Java 8 – 日期和时间实用技巧
当你开始使用Java操作日期和时间的时候,会有一些棘手.你也许会通过System.currentTimeMillis() 来返回1970年1月1日到今天的毫秒数.或者使用Date类来操作日期:当遇到加 ...
- 我的IT之路2013(一)
一眨眼又到了写总结的时候了.废话不多说了,直接切入正题. 春节过后 从春节前开始大概半个月的时间就开始在TKY做物资管理项目,中间穿插了两个考试和J2EE的学习:结束TKY工作后继续深入学习J2EE, ...
- 【小白的CFD之旅】21 网格划分软件的选择
但是怎样才能获得流体计算网格呢?“工欲善其事必先利其器”,画网格该用什么器呢?小白决定找黄师姐请教一番. 小白找到黄师姐的时候,黄师姐正在电脑上忙着. “黄师姐,我发现网格划分软件有好多种,究竟哪种才 ...
- [AWS vs Azure] 云计算里AWS和Azure的探究(2.1)
云计算里AWS和Azure的探究(2.1) ——Amazon EC2 和 WindowsAzure Virtual Machine 刚发表了就发现Amazon的价格下降了,第一代Linux的EC2价格 ...
- 每天一个linux命令(2):file 命令
作用:查看文件类型信息 格式:file[OPTIONS...] [FILE...] 主要参数: --help 显示帮助信息 -v,--version 输出版本信息并退出 -b,--brief ...