解决: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 ...
随机推荐
- 全栈开发——动手打造属于自己的直播间(Vue+SpringBoot+Nginx)
前言 大学的学习时光临近尾声,感叹时光匆匆,三年一晃而过.同学们都忙着找工作,我也在这里抛一份简历吧,欢迎各位老板和猎手诚邀.我们进入正题.直播行业是当前火热的行业,谁都想从中分得一杯羹,直播养活了一 ...
- 已安装 SQL Server 2005,安装 SQL Server 2008 时提示需要删除 SQL Server 2005 Express 工具
错误提示:已安装 SQL Server 2005 Express 工具.若要继续,请删除 SQL Server 2005 Express 工具. 解决方案: 修改注册表:HKLM\Software ...
- 【八】注入框架RoboGuice使用:(Your First Injected Fragment)
上一篇我们简单的介绍了一下RoboGuice的使用([七]注入框架RoboGuice使用:(Your First Custom Binding)),今天我们来看下fragment的注解 ...
- C++的string类常见用法
C++的string常见用法,在网上看到一篇,但是不能在c++11编译器下运行,我修改了下,还没改完: #include<iostream> #include<string> ...
- js获取IP地址方法总结
js代码获取IP地址的方法,如何在js中取得客户端的IP地址.原文地址:js获取IP地址的三种方法 http://www.jbxue.com/article/11338.html 1,js取得IP地址 ...
- 【转】JPA project Change Event Handler / 导致eclipse十分卡
这是Eclipse中的一个GUG: Bug 386171 - JPA Java Change Event Handler (Waiting) 解决方法: 1.) 退出Myeclipse(或eclips ...
- 分布式缓存Memcache和Redis
引言 针对于如今计算机的CPU和网络设施,相应用程序来说,运行效率的瓶颈.已经不是代码的长度(实现同一个功能)和带宽了,而是,代码訪问资源的过程.即:让我们的程序慢下来的罪魁祸首就是IO操作. 程序从 ...
- C和指针第七章第五题
实现一个简化的printf函数,能够处理%d,%f,%s,%c等格式. /*************************************************************** ...
- 每日英语:Chinese Show Global Real-Estate Appetite
Chinese investors have been snapping up real estate in the world's most important cities this year. ...
- 【web技术】html特效代码(二)
html特效代码(一) html特效代码(二) 图片漂浮广告代码 <bodybgcolor="#F7F7F7"> <!--图片漂浮广告代码开始--> < ...