解决: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 ...
随机推荐
- 用Entityframework 调用Mysql时,datetime格式插入不进去数据库的解决办法。
1. 打开Model.edmx, 2. 选择userinfo中的createtime字段的属性 3. storegeneratedpattern设置值为None
- kibana显示报错
"status": 500, "reason": "ElasticsearchException[org.elasticsear ...
- 如何在 ASP.NET 中(服务器端)主动清除(HTTP内容响应时)浏览器中的 Cookies 数据
这个 Cookies 设计的好坑...就不写进坑的过程了,直接贴最终解决代码: //清除 cookies 记录 foreach (var key in Request.Cookies.AllKeys) ...
- destoon入门实例与常见问题
收集了一些destoon入门实例与常见问题,大家做个参考. 链接如下: destoon忘记后台密码怎么办?destoon找回管理员密码 忘记destoon管理员后台账号密码怎么办?解决方法 desto ...
- UITableView当数据很少的时候,去掉多余的cell分割线
转自:http://www.cnblogs.com/bucengyongyou/archive/2012/10/15/2723814.html 在tableView初始化的时候 UIView *v = ...
- java 字符串格式化
转:http://blog.sina.com.cn/s/blog_af26e3330101988v.html 1.对整数进行格式化:%[index$][标识][最小宽度]转换方式 我们可以看到,格式化 ...
- TCP/IP 三次握手,温故知新
今天看网络编程.又又一次看了一遍三次握手.曾经只知道连接有三次握手.今天发现原来断开也有三次握手. 三次握手:指通信两方彼此交换三次信息. 三次握手是在存在数据报丢失.反复和延迟的情况下,确保通信两方 ...
- VS2015 调试中断点突然失效的解决办法、VS调试时关闭调试让浏览器继续保留页面
VS2010 调试中断点突然失效的解决办法 问题描述:在调试前加了断点,但debug时红色的断点变成透明的圆圈加一个感叹号,执行到该处时也不会停止. 这个问题遇到过几次了,前几次都没怎么注意,有时候是 ...
- lua 工具类(一)
-- -- Author: My Name -- Date: 2013-12-16 18:52:11 -- csv解析 -- -- 去掉字符串左空白 local function trim_left( ...
- ROC曲线(Receiver Operating Characteristic Curve)
分类模型尝试将各个实例(instance)划归到某个特定的类,而分类模型的结果一般是实数值,如逻辑回归,其结果是从0到1的实数值.这里就涉及到如何确定阈值(threshold value),使得模型结 ...