Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
|
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 28th, 2003, 04:31 PM
Registered User
 
Join Date: Jul 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to cruzer Send a message via AIM to cruzer
Default "Driver not found" e message, el problems

Hi, getting this message when trying out the jstl sql tags with tomcat.

Using:
linux mandrake 9.1
tomcat 4.1.18
java 1.4.2
standard taglibs 1.0.3
dbase driver DBF_JDBC20.jar

I'm trying to convert jsp page with inline code to jsp page with jstl tags.
JSP page hits up a dbase database and and iterates thru a recordset. The jsp page w/o jstl works fine. The jsp page w/jstl tags doesn't seem to work.

Have followed directions on beginning jsp2 book chapter 3 page 91 ie have put driver in WEB-INF/lib directory (jsp w/o jstl works). My jsp page is as follows:

<%@page contentType="text/html"%>
<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@taglib uri="http://java.sun.com/jstl/sql_rt" prefix="sql" %>
<%@taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>

    <sql:setDataSource var="datasource"
url="jdbc:dbf://usr/local/development/jakarta-tomcat-4.1.18/webapps/ahf/DB"
driver="com.hxtt.sql.dbf.DBFDriver"
user="" password="" />
    <sql:query var="client" dataSource="${datasource}">
        select *
        from clod
    </sql:query>
    <c:forEach var="row" items="${client.rows}">

<script>document.write(fBorrower(<c:outvalue="${ro w.BORROWER}"/>))</script>

<c:out value="${row.LOANOFFICE}"/>

    </c:forEach>

I have stripped out most of the html tags for clarity.

anyway get this error message when I try to use this page:

HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception

org.apache.jasper.JasperException: Unable to get connection, DataSource invalid: "No suitable driver"
        at org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:248)
        at org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:295)
        at org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:241)
        at javax.servlet.http.HttpServlet.service(HttpServlet .java:853)
        at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:247)

This is just part of the error message. If more is requested, will add to thread.

NOTE: When I modified this line:
<%@taglib uri="http://java.sun.com/jstl/sql_rt" prefix="sql" %>
to:
<%@taglib uri="http://java.sun.com/jstl/sql" prefix="sql" %>

the error went away, Not sure why, If anyone can explain I would appreciate it.

The problem with this is that the output doesn't seem to indicate it succesfuly iterated thru the recordset. This is the output html code for the sql declaration w/o _rt in uri:

<script>document.write(fBorrower(${row.BORROWER})) </script>
${row.LOANOFFICE}

Didn't seem that the el script was processed at all. Also it only seemed to have looped 1 time instead of the several times that the jsp w/o jstl tags did. Don't know if the foreach tag loop parameters which is set with el also was the reason it only looped once.

Anyway, from reading this post it seems that the that there is a lot of errata for this book anyway. If anyone can tell me how to get this going, I will use jstl and javabeans instead of inline java code fulltime. Thanks in advance.

 
Old July 28th, 2003, 06:15 PM
Registered User
 
Join Date: Jul 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to cruzer Send a message via AIM to cruzer
Default

Well, 2 people have read it and gone by. I've played with it more and I think I made some more progress.
Have changed these lines:
<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@taglib uri="http://java.sun.com/jstl/sql_rt" prefix="sql" %>
<%@taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>

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

apparently mixing and matching _rt uri with non _uri isn't working. hehe

Anyhow, it's now working fine. If someone could still post why the _rt declarations won't work with driver jar located in the application/WEB-INF/lib directory, would be much appreciated. Also why you need to have c:out tag for el script output to show? Book uses it sometimes and sometimes it doesn't. By the way if anyone knows how to get this to work with the _rt uri tag declarations that would be nice also. Thanks



 
Old December 19th, 2004, 02:13 AM
Registered User
 
Join Date: Dec 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

For my code below, I tried both "core_rt" and "core" methods. It just won't work, and I got error messages like "org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application". HELP...!

But I'm able to connect using this method:
"
<%@ page import="java.util.*" %>
<%@ page import="java.sql.*" %>
<% Class.forName("com.mysql.jdbc.Driver").newInstance (); ...
String url = "jdbc:mysql://localhost/ise";
String user = "abc";
String password = "abc";
Connection conn = DriverManager.getConnection(url,user,password);%>
"

Below is my original code (which have problem):

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %>
<sql:setDataSource var="datasource"
                   driver="com.mysql.jdbc.Driver"
                   url="jdbc:mysql://localhost/ise
                   user="abc" password="abc" />
<sql:query var="user" dataSource="${datasource}">
    SELECT * FROM users
</sql:query>
<html>
<head>
    <title>mysql test</title>
</head>
<body>
<table border="1">
    <tr>
        <th>uid</th>
        <th>user name</th>
        <th>e-mail</th>
        <th>contact</th>
        <th>password</th>
        <th>access level</th>
    </tr>
<c:forEach i="${user.rows}" var="row">
    <tr>
        <td><c:out value="${row.uid}" /></td>
        <td><c:out value="${row.userName}" /></td>
        <td><c:out value="${row.contactNum}" /></td>
        <td><c:out value="${row.email}" /></td>
        <td><c:out value="${row.password}" /></td>
        <td><c:out value="${row.accessLevel}" /></td>
    </tr>
</c:forEach>
</table>
</body>
</html>






Similar Threads
Thread Thread Starter Forum Replies Last Post
Data source name not found and no default driver s Durkee VB.NET 2002/2003 Basics 0 September 21st, 2007 01:11 PM
No sutitable Driver found....... programmed Java Databases 2 September 4th, 2007 07:18 AM
Chapter 16 - Driver Not Found - Please Help wil324 JSP Basics 0 November 2nd, 2003 05:22 AM
Data source name not found and no default driver s bjtindle Classic ASP Databases 5 September 10th, 2003 04:35 AM
Ch 16 driver not found dmswdev JSP Basics 1 June 27th, 2003 05:15 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.