私はjsp Web開発に不慣れで、アプリケーションをデバッグしてデータベースを読み取れるようにすると、次のエラーが発生します。
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
この問題に関して、インターネットを複数のサイトで長い間調査しましたが、何も修正できませんでした。これらは私の仕様です:
IDE: Eclipse/ JSP バージョン: 2.0/ サーブレット バージョン: 2.4/ JSTL バージョン: 1.1.1/ Tomcat バージョン: 7.0.35/
これは私の WEB-INF/web.xml ファイルです
<?xml version="1.0" encoding="UTF-8" ?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-app_2_4.xsd"
version="2.4">
<resource-ref>
<description>Resource configuration for database connection</description>
<res-ref-name>jdbc/TestDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</web-app>
これは私の META-INF/context.xml ファイルです
<?xml version="1.0" encoding="UTF-8" ?>
<Context>
<Resource name="jdbc/TestDB" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="admin" password="admin" driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/checklist_pdnf"/>
</Context>
そして、これは私のjspファイルです
<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
<sql:query var="db" dataSource="jdbs/TestDB">
select * from patient
</sql:query>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<div>
<table>
<c:forEach var="row" items="${db.rows}">
<tr>
<td>row.getString("patient_medicalRecordNumber")</td>
<td>row.getString("patient_lastName")</td>
<td>row.getString("patient_firstName")</td>
<td>row.getString("patient_middleName")</td>
<td>row.getString("patient_dateOfBirth")</td>
<td>row.getString("patient_gender")</td>
<td>row.getString("patient_admissionDateTime")</td>
<td>row.getString("patient_dischargeDateTime")</td>
<td>row.getString("patient_attendingPhysician")</td>
<td>row.getString("patient_locationRoom")</td>
</tr>
</c:forEach>
</table>
</div>
</body>
</html>