严重: Servlet.service() for servlet jsp threw exception org.apache.jasper.JasperException: According t

出现问题:

严重: Servlet.service() for servlet jsp threw exceptionorg.apache.jasper.JasperException: /WEB-INF/jsp/studentInfo.jsp (line: 42, column: 2) According to TLD or attribute directive in tag file, attribute items does not accept any expressions。

解决方案:

将<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%>改成<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>(多了一个jsp路径)

问题原因:

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%>为JSTL1.0的版本,在JSP2.0(Serlvet 2.4)及以后版本中推荐使用JSTL1.1及以上版本。

总结-------jstl与servlet的版本搭配

Version JSTL version Requirements  
Standard 1.2 JSTL 1.2 (not yet JCP approved) Servlet 2.5, JavaServer Pages 2.1  
Standard 1.1 JSTL 1.1 Servlet 2.4, JavaServer Pages 2.0  
Standard 1.0 JSTL 1.0 Servlet 2.3, JavaServer Pages 1.2  

Servlet2.3及以前

jsp代码

<%@taglib prefix="c" uri="http://java.sun.com/jstl/core" %>

在servlet2.4及以后

jsp代码---引入路径多了一个“jsp”

<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>


原文地址:http://lichunhui.iteye.com/blog/1914706


你可能感兴趣的:(jsp)