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

严重: 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 " %>
一定要记得加引号!
就输出正常了。
发布了26 篇原创文章 · 获赞 2 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/liaoze2010/article/details/70239831
tld
今日推荐