今天在做一个SSH整合测验时发现了一个异常(According to TLD or attribute directive in tag file)

本文介绍了解决JSP页面使用JSTL时出现的表达式不被接受的问题,通过更改标签库引用解决了EL表达式无法正常使用的情况。

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

严重: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: /WEB-INF/page/employee.jsp(24,3) According to TLD or attribute directive in tag file, attribute items does not accept any expressions
页面上的源码如下:
1 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
2  <%@ taglib uri="/struts-tags" prefix="s" %>
3  <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
4  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
5 <html>
6 <head>
7
8 <title>employee</title>
9
10 <meta http-equiv="pragma" content="no-cache">
11 <meta http-equiv="cache-control" content="no-cache">
12 <meta http-equiv="expires" content="0">
13
14 </head>
15
16 <body>
17 ONGL:
18 <s:iterator value="#request.employees">
19 <s:property value="username"/>,<s:property value="password"/>,<s:property value="gender"/>
20 </s:iterator>
21 <br/>
22
23 JSTL/EL:
24 <c:forEach items="${employees}" var="employee">
25 ${employee.username}, ${employee.password}, ${employee.gender}<br/>
26 </c:forEach>
27 </body>
28 </html>
异常提示,在第24行的时候发生错误,说不接受任何表达式,后来在网上找到一个解决方案,说是版本不支持EL,所以把
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
改为:
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
一定要记得加引号!
就输出正常了。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值