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


相关文章
|
12天前
|
Java
JSTL jar包版本错误attribute items does not accept any expressions
确保你在 `items` 属性中使用了一个实际的集合或数组变量,而不是表达式,以解决这个问题。
11 0
|
2月前
No resource identifier found for attribute,RxJava之zip操作符
No resource identifier found for attribute,RxJava之zip操作符
9 0
|
4月前
|
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...]
|
10月前
使用pageHelper报错 Type definition error: [simple type, classXXXX]
使用pageHelper报错 Type definition error: [simple type, classXXXX]
|
11月前
报错 An error happened during template parsing (template: “ServletContext resource [/shiroTest.html]“)
报错 An error happened during template parsing (template: “ServletContext resource [/shiroTest.html]“)
|
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
84 0
|
JavaScript
element-ui报错[Vue warn]: Invalid prop: custom validator check failed for prop “index“.一个符号解决问题
element-ui报错[Vue warn]: Invalid prop: custom validator check failed for prop “index“.一个符号解决问题
583 0
No injector for custom defined data type的解决办法
No injector for custom defined data type的解决办法
224 0
No injector for custom defined data type的解决办法
|
中间件
equipment header attribute mapping - two settypes in middleware
equipment header attribute mapping - two settypes in middleware
equipment header attribute mapping - two settypes in middleware