This thread may be very helpful to you:
http://forums.sun.com/thread.jspa?messageID=3335080
Essentially you've declared your tags for jstl 1.1, which requires
servlet spec 2.4, not 2.3. Replace the DOCTYPE and <web-app> with this
in your web.xml:
<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
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
Also the others are right on the datasource in your sql tags. The error
you got using the JNDI name suggests you don't have the right jdbc
driver in tomcat's common/lib directory for the database you are trying
to connect to. Put your mysql-connector-java-[whaever vesion].jar file
in tomcat's common/lib directory. Be sure you do not have another copy
in your webapp's WEB-INF/lib directory. If it exists in common/lib, it
cannot be in the webapp's WEB-INF/lib directory.
--David
[EMAIL PROTECTED] wrote:
I'm going to guess the servlet spec version in your web.xml isn't up to
a level that supported the JSTL expression language. What's your
web.xml look like?
web.xml looks:
------------------------------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>Eine Web - Applikation</display-name>
<!-- Definition eines symbolischen Servlet-Namens -->
<servlet>
<servlet-name>HelloWorldServlet</servlet-name>
<servlet-class>
de.akdabas.jli.j2ee.servlets.HelloWorld
</servlet-class>
</servlet>
<!-- Beispiel-Konfiguration des Datenbank-Servlets -->
<servlet>
<servlet-name>DatabaseServlet</servlet-name>
<servlet-class>
de.akdabas.jli.j2ee.servlets.DatenbankServlet
</servlet-class>
<init-param>
<param-name>jdbcClass</param-name>
<param-value>com.mysql.jdbc.Driver</param-value>
</init-param>
<init-param>
<param-name>dbURL</param-name>
<param-value>jdbc:mysql://localhost:3306/javatest</param-value>
</init-param>
<init-param>
<param-name>username</param-name>
<param-value>javauser</param-value>
</init-param>
<init-param>
<param-name>password</param-name>
<param-value>javadude</param-value>
</init-param>
</servlet>
<!-- Konfiguration des ImageServlets -->
<servlet>
<servlet-name>ImageServlet</servlet-name>
<servlet-class>
de.akdabas.jli.j2ee.servlets.ImageServlet
</servlet-class>
</servlet>
<!-- Binden des symbolischen Namens an eine URL -->
<servlet-mapping>
<servlet-name>HelloWorldServlet</servlet-name>
<url-pattern>/servlets/HelloWorld</url-pattern>
</servlet-mapping>
<!-- Binden des Datenbank-Servlets an eine URL -->
<servlet-mapping>
<servlet-name>DatabaseServlet</servlet-name>
<url-pattern>/servlets/DatenbankServlet</url-pattern>
</servlet-mapping>
<!-- Binden des Image-Servlets an eine URL -->
<servlet-mapping>
<servlet-name>ImageServlet</servlet-name>
<url-pattern>/servlets/DynamicImage</url-pattern>
</servlet-mapping>
</web-app>
------------------------------
--David
ge wrote:
Hi,
Servlet works, jsp not. Why?
Result of servlet:
--------------------
Datensätze
jdbc:mysql://localhost:3306/javatest com.mysql.jdbc.Driver
javauser javadude
Name Vorname
1 hello
2 hellox
Result of jsp:
-----------------
Results
${row.foo} ${row.bar}
<snip>Unimportant stuff</snip>
jsp code:
---------
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<sql:query var="rs"
dataSource="jdbc:mysql://localhost:3306/javatest?user=javauser&password=javadude">
select id, foo, bar from testdata
</sql:query>
<html>
<head>
<title>DB Test</title>
</head>
<body>
<h2>Results</h2>
<table>
<c:forEach var="row" items="${rs.rows}">
<tr>
<td> <c:out value="${row.foo}"/></td>
<td> <c:out value="${row.bar}"/></td>
</tr>
</c:forEach>
</table>
</body>
</html>
<snipp>Unimportant stuff</snip>
Thanks in advance for any help: Eleonora
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]