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"%>


相关文章
|
2月前
|
Ubuntu Linux
progs/verifier_netfilter_retcode.c:42:1: error: unknown attribute 'btf_decl_tag' ignored
progs/verifier_netfilter_retcode.c:42:1: error: unknown attribute 'btf_decl_tag' ignored
‘;‘ expected,Missing semicolon.Syntax Missing semicolon multi (web,若依定义方法,修改method,之后在mounted()用this
‘;‘ expected,Missing semicolon.Syntax Missing semicolon multi (web,若依定义方法,修改method,之后在mounted()用this
|
5月前
|
XML 数据格式
Xml declaration should precede all document content
Xml declaration should precede all document content
|
6月前
|
Java
JSTL jar包版本错误attribute items does not accept any expressions
确保你在 `items` 属性中使用了一个实际的集合或数组变量,而不是表达式,以解决这个问题。
51 0
|
6月前
|
JSON Java 数据格式
Could not extract response: no suitable HttpMessageConverter found for ..content type [text/html...]
Could not extract response: no suitable HttpMessageConverter found for ..content type [text/html...]
676 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
131 0
|
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".
201 0
Open quote is expected for attribute "{1}" associated with an element type "id".
【JSP jstl c标签】使用c:foreach 报错(警告)”test does not support runtime expressions“
后台封装的数据是个list,传递给前台,显示如下: 1 2 用户Name: ${user.myUserName} 3 用户Id: ${user.
1170 0