今天搞JSTL时,发现了一个很大问题,JSTL什么语法都没错的情况下还报以下的错:
org.apache.jasper.JasperException: /index.jsp(42,5) According to TLD or attribute directive in tag file, attribute items does not accept any expressions
太惊喜了,终于找到原因所在,原来是web.xml里的版本问题:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5
"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5
.xsd">
以上的配置是出现问题的配置,把2.5的版本改成2.3
就可以了;如下:
<web-app version="2.3
"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_3.
xsd">
分享到:
相关推荐
- 在JSP 2.4版本中,使用JSTL可能遇到与EL(Expression Language)的兼容性问题,导致错误提示“According to TLD or attribute directive in tag file, attribute value does not accept any expressions”。...
**JSP指令元素-TLD与Taglib** 在JavaServer Pages (JSP) 技术中,`<jsp:...在实际项目中,常见的开源Taglib有JSTL(JavaServer Pages Standard Tag Library)、Struts的Tiles库等,它们极大地丰富了JSP的功能。
3. JSP Tag File:实现自定义标签的具体逻辑,可以包含JSP脚本、EL表达式、JSTL标签等。 三、结合Properties配置文件使用自定义标签 1. 在TLD文件中引用properties文件:在TLD文件中,可以声明一个属性,该属性引用...
2. 标签库描述文件(TLD,Tag Library Descriptor):这是一个XML文件,用于定义标签、属性、标签库的元数据等。 3. 标签库引用(Taglib Directive):在JSP页面中,通过`<%@ taglib %>`指令引入自定义标签库。 **...
在Java服务器页面(JSP)技术中,简单标签(Simple Tags)是自定义标签的一种形式,它们为开发者提供了更简洁、可读性更强的代码,相比传统的JSP脚本元素和自定义标签库(Tag Library Directive,TLD),简单标签在...
5. **自定义指令的增强**:新增了`<jsp:directive.page>`、`<jsp:directive.include>`和`<jsp:directive.attribute>`等指令,使得对页面、包含文件以及自定义标签属性的控制更加强大。 6. **错误处理与异常处理**:...