According to TLD or attribute directive in tag file, attribute items does not accept any expressions

本文介绍了解决在使用JSTL时遇到的attributeitems不接受表达式的错误方法。错误可能是由于web.xml文件中的版本号不兼容导致。提供了两种解决方案:一是修改JSTL包的导入代码,二是更新web.xml中的web-app版本号。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

According to TLD or attribute directive in tag file, attribute items does not accept any expressions

解释:根据标记文件中的tld或attribute指令,attribute items不接受任何表达式**

造成错误出现可能的原因:
web.xml文件中的版本号不兼容,有两种方法可解决。

第一种方法:

修改导入jstl包的引入代码
将jsp文件中导入jstl包语句修改一下:
修改前:
<%@ taglib uri=“http://java.sun.com/jstl/core” prefix=“c”%>
修改后:
<%@ taglib uri=“http://java.sun.com/jstl/core_rt” prefix=“c”%>

第二种方法:

修改版本号

主要修改在web-app中,我的版本兼容3.1的,自己可以新建一个Dynamic Web Project,同时自动生成一个web.xml文件,将两个web.xml文件替换为自己新生成的web.xml中的web-app。新建项目时不会生成web.xml的看下图(新建项目时,一步一步来,最后一步时,将红圈处打上勾,就会自动生成web.xml了,生成的web.xml在WebContent\WEB-INF目录下)。

在这里插入图片描述
修改前:

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns="http://java.sun.com/xml/ns/javaee" 
 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
 http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" 
 id="WebApp_ID" version="3.0">

修改后:

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns="http://xmlns.jcp.org/xml/ns/javaee"
  xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
   http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
    id="WebApp_ID" version="3.1">
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值