I'm really new to java so you'll have to forgive me.  here is the setup:

j2sdk1.4.2_06 (rpm from sun)
apache-ant-1.6.2 (from apache.org)
jakarta-tomcat-5.0.28 (from apache.org)
jakarta-taglibs-standard-1.1.2 (from apache.org)
MySQL-server-4.1.7-0 (rpm from MySQL AB)
mysql-connector-java-3.0.15-ga (zip from MySQL AB)

and I've done the following:

1. setup the JAVA_HOME and ANT_HOME environment variables
2. copied the jakarta-tomcat-5.0.28/server/lib/catalina-ant.jar
to ANT_HOME/lib
3. copied the mysql-connector-java-3.0.15-ga
to jakarta-tomcat-5.0.28/common/lib
4. copied jakarta-taglibs-standard-1.1.2/lib/*.jar
to jakarta-tomcat-5.0.28/common/lib

I already had mysql setup with some sample data and verified that the
username and password worked as well as a few queries.

I've created an example application with the following structure:

./src
./src/net
./src/net/level1tech
./src/net/level1tech/EpayManager.java
./build.xml
./web
./web/META-INF
./web/META-INF/context.xml
./web/WEB-INF
./web/WEB-INF/web.xml
./web/index.jsp
./docs
./build.properties

I modified the example build.xml file that comes with tomcat to pass a
'config' param and point to my build/META-INF/context.xml file.  I just
use it to setup the database as a Resource in the context.  I added the
corresponding resource-ref to the WEB-INF/web.xml file.  The application
has been deployed using "ant install" and everything seems to work ok.
The servlet is just a hello world type program and works fine.

Here is a copy of the index.jsp:

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

<sql:query var="rs" dataSource="jdbc/EpayManager">
SELECT username FROM tbUser
</sql:query>

<html>
  <head>
    <title>tbUser</title>
  </head>
  <body>

  <h2>Results</h2>
<c:forEach var="user" begin="0" items="${rs.rows}">
    <c:out value="${user.username}" /><br/>
</c:forEach>

Row Count: "<c:out value="${rs.rowCount}" />"<br>
  </body>
</html>

As you can see its pretty darn basic.  Here is the source for the html
that is generated:

<html>
  <head>
    <title>tbUser</title>
  </head>
  <body>

  <h2>Results</h2>
    ${user.username}<br/>

Row Count: "${rs.rowCount}"<br>
  </body>
</html>

The annoying thing is that the database is being connected to and if I
mess up the query it complains about it not being a valid query.  The
query also shows up in the mysql server log files.  I can see all the
connections etc and there are no errors in the mysql server error log
files.  So basically, the taglibs SEEM to be working, but not entirely.

I've tried adding the taglib's rar files to the WEB-INF/lib directory of
my application and adding the corresponding taglib entries in the WEB-
INF/web.xml file to no avail.  I really don't think thats it, since they
are installed in the tomcat common lib directory.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to