jstl错误:According to TLD or attribute directive in tag file, attribute value does not accept any expr

简介: jstl错误:According to TLD or attribute directive in tag file, attribute value does not accept any expr

JSP 页面中使用 JSTL 标签库,访问 JSP 页面时抛出了如下异常信息:

org.apache.jasper.JasperException: /index.jsp (line: 261, column: 54) According to TLD or attribute directive in tag file, attribute value does not accept any expressions
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:41)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)

原因:因为使用了 JSP 2.0, 但又没有使用 JSTL 标签库的备用版本(RT库)

解决

方案1. 修改web.xml

<!--将 web.xml 中的 声明由 2.4 或 2.5 版本的修改为 2.3 版本-->
<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">

修改为:

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>

方案2. 使用JSTL core RT库

JSTL 标签库的有两种 taglib 伪指令, 其中 RT 库即是依赖于 JSP 传统的请求时属性值, 而不是依赖于 EL 来实现:

只要将

<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>

改为

<%@ taglib uri=http://java.sun.com/jstl/core_rt prefix="c"%>


相关文章
Invalid mapping pattern detected: /download/{{fileName}} ^Not allowed to nest variable c
Invalid mapping pattern detected: /download/{{fileName}} ^Not allowed to nest variable c
|
7月前
|
Java
JSTL jar包版本错误attribute items does not accept any expressions
确保你在 `items` 属性中使用了一个实际的集合或数组变量,而不是表达式,以解决这个问题。
59 0
使用pageHelper报错 Type definition error: [simple type, classXXXX]
使用pageHelper报错 Type definition error: [simple type, classXXXX]
解决报错之 - error Identifier ‘attr_id‘ is not in camel case camelcase
解决报错之 - error Identifier ‘attr_id‘ is not in camel case camelcase
449 0
解决报错之 - error Identifier ‘attr_id‘ is not in camel case camelcase
对‘avformat_find_stream_info’未定义的引用、to the PKG_CONFIG_PATH environment variable
对‘avformat_find_stream_info’未定义的引用、to the PKG_CONFIG_PATH environment variable
94 0
The 'manifest_version' key must be present and set to 2 (without quotes)
The 'manifest_version' key must be present and set to 2 (without quotes)
89 0
|
Java
The type XXX cannot be resolved. It is indirectly referenced from required .class files
The type XXX cannot be resolved. It is indirectly referenced from required .class files
143 0
错误解决办法:‘NULL’ was not declared in this scope
错误解决办法:‘NULL’ was not declared in this scope
266 0
|
SQL 并行计算 PyTorch
解决报错:‘NoneType‘ object has no attribute ‘origin‘
在跑几个月前跑过PyG的GNN模型时,突然当头一棒报错:'NoneType' object has no attribute 'origin',不要慌,赶紧百度 一顿操作猛如虎,发现没几个帖子讲这个,然后发现google后git
1157 0
解决报错:‘NoneType‘ object has no attribute ‘origin‘
|
XML Java 数据库连接
Open quote is expected for attribute "{1}" associated with an element type "id".
Open quote is expected for attribute "{1}" associated with an element type "id".
209 0
Open quote is expected for attribute "{1}" associated with an element type "id".

热门文章

最新文章