Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Other Java > Java Databases
|
Java Databases Discussion specific to working with Java Databases. For other Java topics, please see related Java forums. For database discussions not specific to Java, please see the Database category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java Databases 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 May 29th, 2005, 04:05 AM
Registered User
 
Join Date: May 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Need help with JSP data retrieval


hi,

I have recently started working on jsp and i m using beginning jsp2: from novice to
professional. I tried working out a code on retriving data from a table and heres the thing

I browsed through every possible forum trying to draw analogies from
those who encountered the same problems earlier...but i couldnt solve it...


<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql_rt" %>

<sql:setDataSource var="datasource"
                   driver="com.mysql.jdbc.Driver"
                   url="jdbc:mysql://localhost/saurabh"
                   user="crashpoint" password="unplugged"/>

<sql:query var="books" dataSource="${datasource}">
SELECT id,title FROM book
</sql:query>

<html>
  <head>
    <title> Database book </title>
  </head>

 <body>
   <c:forEach items="${books.rows}" var="row">
     <c:out values="${row.id}"/><br>
     <c:out values="${row.title}"/><br>
   </c:forEach>

 </body>
 </html>

I have the following directory structure

c:\java\tomcat50\webapps\access\WEB-INF\lib which contains jstl.jar ; standard.jar and
the mysql connector jar file.

My WEBINF folder contains the web.xml file with the following contents

<?xml version="1.0" encoding="ISO-8859-1"?>
<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">
...
</web-app>


I tried to run the code but i repeatedly keep on getting this error:

org.apache.jasper.JasperException: /booklist.jsp(20,5) According to the TLD or the tag file, attribute value is mandatory for tag out
    org.apache.jasper.compiler.DefaultErrorHandler.jsp Error(DefaultErrorHandler.java:83)
    org.apache.jasper.compiler.ErrorDispatcher.dispatc h(ErrorDispatcher.java:402)
    org.apache.jasper.compiler.ErrorDispatcher.jspErro r(ErrorDispatcher.java:274)
    org.apache.jasper.compiler.Validator$ValidateVisit or.visit(Validator.java:722)
    org.apache.jasper.compiler.Node$CustomTag.accept(N ode.java:1458)
    org.apache.jasper.compiler.Node$Nodes.visit(Node.j ava:2180)
    org.apache.jasper.compiler.Node$Visitor.visitBody( Node.java:2230)
    org.apache.jasper.compiler.Validator$ValidateVisit or.visit(Validator.java:759)
    org.apache.jasper.compiler.Node$CustomTag.accept(N ode.java:1458)
    org.apache.jasper.compiler.Node$Nodes.visit(Node.j ava:2180)
    org.apache.jasper.compiler.Node$Visitor.visitBody( Node.java:2230)
    org.apache.jasper.compiler.Node$Visitor.visit(Node .java:2236)
    org.apache.jasper.compiler.Node$Root.accept(Node.j ava:485)
    org.apache.jasper.compiler.Node$Nodes.visit(Node.j ava:2180)
    org.apache.jasper.compiler.Validator.validate(Vali dator.java:1515)
    org.apache.jasper.compiler.Compiler.generateJava(C ompiler.java:247)
    org.apache.jasper.compiler.Compiler.compile(Compil er.java:456)
    org.apache.jasper.compiler.Compiler.compile(Compil er.java:439)
    org.apache.jasper.JspCompilationContext.compile(Js pCompilationContext.java:552)
    org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:291)
    org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:301)
    org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:248)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:856)

I have all the classpaths configured and all as


set CATALINA_HOME=C:\java\tomcat50

set JAVA_HOME=C:\java\j2sdk1.4.2

SET CLASSPATH=%CATALINA_HOME%\common\lib\servlet-api.jar;C:\java\mysql-connector\mysql-connector-java-3.0.16-ga.jar;C:\java\j2sdk1.4.2\jre\lib\ext\mysql-connector-java-3.0.16-ga-bin.jar;

PATH %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\Sy stem32\Wbem;C:\java\j2sdk1.4.2\bin;%JAVA_HOME%\bin ;%CATALINA_HOME%\bin

in my autoexec.bat....

A little help anyone?

Thanks for reviewing my post... have a nice day....


----> What i really need is a job that does not interfere with my work <----



 
Old August 3rd, 2005, 01:00 AM
Authorized User
 
Join Date: Aug 2004
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to olupas
Default


Hi

I've used dbtabs from apache and it works fine...

Try mention this in your web.xml if you did not:

 <taglib>
    <taglib-uri>/dbtags</taglib-uri>
    <taglib-location>/WEB-INF/tlds/your_db_tab.tld</taglib-location>
  </taglib>

LOOP






Similar Threads
Thread Thread Starter Forum Replies Last Post
inserting data into database using a jsp ronnie JSP Basics 4 January 15th, 2015 11:35 AM
readd xml data from jsp dimpleboy JSP Basics 0 December 29th, 2006 08:16 PM
arraylist need to store data from jsp kotaiah JSP Basics 0 October 14th, 2006 01:57 AM
For XML data retrieval fancorning4 SQL Server 2000 2 May 18th, 2006 10:33 AM
Data retrieval using MySQL rajanikrishna Beginning PHP 2 November 12th, 2003 11:38 PM





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