jstl初学
今天在一同学那里看到一个jstl的错误如下:According to TLD or attribute directive in tag file, attribute items does not accept any expressions
环境是: winxp sp2 +jdk1.6.0.03+eclipse3.3.1 +tomcat5.5.25
在一个jsp页面里面调用 el 时出现的这个错误,上网查了一下,然后按照有些人的解决办法把jsp页面开头的
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
换成了
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core_rt" %>
之后,错误消失,上网查后说是jsp版本的缘故,大概如下:
问题:
環境jboss4.05ga
jstl版本為1.1
當
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ page isELIgnored="true" %>
<c:out value="${1+1 }"></c:out> 是可以的,但是如果把<%@ page isELIgnored="true" %>拿掉就會出現
type Exception report
可是當改為<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
又可以正常執行,我想請問其中的差異為?謝謝!
回答:
請先改用
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
你那個是比較就的版本
當時因為jsp不支援el,所以等於是elignore的狀態讓tag處理
rt則是爲了可以使用<%="1+1"%>
你可以用isELIgnored="true"然後跑core_rt看看
原因大概是這樣
所以如果是現在的系統
請都用
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
还有一篇个人博客上的有关此问题的说明如下:
Exception:According to TLD or attribute directive in tag file, attribute value does not accept any expression
Exception:According to TLD or attribute directive in tag file, attribute value does not accept any expression
应 用部署运行的时候出现JSP异常, 发生在使用JSTL库的时候: According to TLD or attribute directive in tag file, attribute value does not accept any expressions, 可能是因为使用了JSP2.0版本, 同时又没有使用JSTL core库的备用版本(RT库), 以下有两种处理方法:
1. 修改web.xml.
<div style="border: 1px solid rgb(204, 204, 204); margin: 5px 20px; padding: 5px;"><web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
页:
[1]