tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eleonor...@gmx.net
Subject Re: servlet works, jsp not, why? (Tomcat 5.0)
Date Thu, 14 Aug 2008 19:30:40 GMT
Please see in text
> This thread may be very helpful to you: 
> http://forums.sun.com/thread.jspa?messageID=3335080

The thread is about EL- I do not use xpression Language.

> 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">

Replaced, no change in display

 
> 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.

As soon as I copy  mysql-connector-java-5.1.5-bin.jar
into /usr/share/tomcat5/common/lib, and try test.jsp, I get this:
javax.servlet.ServletException: Unable to get connection, DataSource invalid: "java.sql.SQLException:
No suitable driver found for jdbc:mysql://localhost:3306/javatest?user=javauser&password=javadude"

Also please consider, servlet works, just jsp does not.
Driver and web.xml are common for both, aren't they?
Please advise, thanks, Eleonora
 
> --David
> 
> eleonora46@gmx.net 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
> >>>       

-- 
Psssst! Schon das coole Video vom GMX MultiMessenger gesehen?
Der Eine für Alle: http://www.gmx.net/de/go/messenger03

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message