jstl 问题rg.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsp/jstl/core cannot

ljh0242 2009-04-02 02:27:19
想用下jstl,用法如下:
报错结果:rg.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application

web.xml配置如下:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<taglib>
<taglib-uri>http://java.sun.com/jstl/fmt</taglib-uri>
<taglib-location>/WEB-INF/tlds/fmt.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>http://java.sun.com/jstl/fmt-rt</taglib-uri>
<taglib-location>/WEB-INF/tlds/fmt-rt.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
<taglib-location>/WEB-INF/tlds/c.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>http://java.sun.com/jstl/core-rt</taglib-uri>
<taglib-location>/WEB-INF/tlds/c-rt.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>http://java.sun.com/jstl/sql</taglib-uri>
<taglib-location>/WEB-INF/tlds/sql.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>http://java.sun.com/jstl/sql-rt</taglib-uri>
<taglib-location>/WEB-INF/tlds/sql-rt.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>http://java.sun.com/jstl/x</taglib-uri>
<taglib-location>/WEB-INF/tlds/x.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>http://java.sun.com/jstl/x-rt</taglib-uri>
<taglib-location>/WEB-INF/tlds/x-rt.tld</taglib-location>
</taglib>

<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>3</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>3</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>

jsp页面
<%@ page language="java" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'display.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->

</head>

<body>
<c:forEach items="${requestScope['guestbook.display.list']}" var="article">
<c:out value="${article.id}"/>
<c:out value="${article.name}"/>
<c:out value="${article.email}"/>
<c:out value="${article.phone}"/>
<c:out value="${article.title}"/>
<c:out value="${article.content}"/>
<c:out value="${article.time}"/>

</c:forEach>

</body>
</html>
不知道为什么web.xml :<taglib>
<taglib-uri>http://java.sun.com/jstl/fmt</taglib-uri>
<taglib-location>/WEB-INF/tlds/fmt.tld</taglib-location>
</taglib
起始处报错,程序运行报错:rg.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
我想是配置问题,大家都遇到过没有啊??

...全文
6944 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
againczz 2011-07-26
  • 打赏
  • 举报
回复
我也是这个问题......
ouyangxiaokang6 2009-04-03
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 chenxinhong98 的回复:]
用jstl标签库不用配置web.xml呀,直接将jstl.jar和standard.jar拷到WEB-INF/lib下面,再将对应的tld文件放到WEB-INF/下面.在jsp页面中可以直接引用 <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>.
[/Quote]
但是你的网络连接是可以。就是你得能上网。
酒浪子 2009-04-02
  • 打赏
  • 举报
回复
用jstl标签库不用配置web.xml呀,直接将jstl.jar和standard.jar拷到WEB-INF/lib下面,再将对应的tld文件放到WEB-INF/下面.在jsp页面中可以直接引用<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>.
ljh0242 2009-04-02
  • 打赏
  • 举报
回复
恩,tld文件都放进去了啊,在>/WEB-INF/tlds/下
sjzxqrj 2009-04-02
  • 打赏
  • 举报
回复
tld 文件都放进去了吗

81,091

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧