tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Morgan Delagrange <mdela...@yahoo.com>
Subject Re: Newbie problems with JDBC taglib
Date Mon, 19 Mar 2001 17:57:38 GMT

--- Steve Philp <sphilp@ameritech.net> wrote:
> I'm having a problem using the JDBC taglib
> (031701.tar.gz, but also
> tried 031601.tar.gz) that I'm hoping someone can
> help me out with...
> 
> The page looks like:
> 
> <%@ taglib
> uri="http://jakarta.apache.org/taglibs/jdbc"
> prefix="sql" %>
> <table width="100%">
> <tr>
>   <th align=left>Customer Name</th>
>   <th align=left>Available Reports</th>
> </tr>
> <sql:connection id="conn"
> jndiName="java:comp/env/jdbc/advdb"/>
>  
> <sql:preparedStatement id="stmt1" conn="conn">
>         <sql:query>
>                 SELECT 
> 			CSCODE, 
> 			CSNAME 
> 		FROM 
> 			CUSTOMER 
> 		WHERE 
> 			CSNAME LIKE ? 
> 			AND SACODE IN (?) 
> 			AND CSTYPE = 'A' 
> 		ORDER BY 2
>         </sql:query>
>  
>         <sql:execute>
>                 <sql:setColumn position="1">
> 			<%=request.getParameter("Customer") + "%" %>
> 		</sql:setColumn>
>                 <sql:setColumn
> position="2">4</sql:setColumn>
>         </sql:execute>
>  
>         <sql:resultSet id="rs1">
>                 <tr>
> 	                <td><sql:getColumn
> position="1"/></td>
> 	                <td><sql:getColumn
> position="2"/></td>
> 		</tr>
>         </sql:resultSet>
> </sql:preparedStatement>
> </table>
> <sql:closeConnection conn="conn"/>
> 
> 
> When I execute that page under Resin 1.2.1 (IBM JDK
> 1.3 on Linux) I get
> the following error:
> 
> java.lang.NoSuchMethodError:
> javax.servlet.jsp.tagext.TagData: method
> getAttributes()Ljava/util/Enumeration; not found
>         at
>
org.apache.taglibs.jdbc.resultset.BaseGetterTEI.isValid(BaseGetterTEI.java:78)
>         at
>
com.caucho.jsp.JspGenerator.generateMyTag(JspGenerator.java:747)
>         at
>
com.caucho.jsp.JspGenerator.generateTaglib(JspGenerator.java:713)
>         at
>
com.caucho.jsp.JspGenerator.generateChildren(JspGenerator.java:679)
>         at
>
com.caucho.jsp.JavaGenerator.printTagInstance(JavaGenerator.java:634)
>         at
>
com.caucho.jsp.JspGenerator.generateMyTag(JspGenerator.java:769)
>         at
>
com.caucho.jsp.JspGenerator.generateTaglib(JspGenerator.java:713)
>         at
>
com.caucho.jsp.JspGenerator.generateChildren(JspGenerator.java:679)
>         at
>
com.caucho.jsp.JavaGenerator.printTagInstance(JavaGenerator.java:634)
>         at
>
com.caucho.jsp.JspGenerator.generateMyTag(JspGenerator.java:769)
>         at
>
com.caucho.jsp.JspGenerator.generateTaglib(JspGenerator.java:713)
>         at
>
com.caucho.jsp.JspGenerator.generateChildren(JspGenerator.java:679)
>         at
>
com.caucho.jsp.JspGenerator.generate(JspGenerator.java:237)
>         at
> com.caucho.jsp.JspParser.parse(JspParser.java:213)
>         at
> com.caucho.jsp.JspParser.parse(JspParser.java:149)
>         at
> com.caucho.jsp.XtpPage.getJspPage(XtpPage.java:482)
>         at
>
com.caucho.jsp.XtpPage.compileJspPage(XtpPage.java:338)
>         at
> com.caucho.jsp.XtpPage.subservice(XtpPage.java:204)
>         at
> com.caucho.jsp.Page.service(Page.java:334)
>         at
>
com.caucho.server.http.Invocation.service(Invocation.java:255)
>         at
>
com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:201)
>         at
>
com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:217)
>         at
>
com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:151)
>         at
>
com.caucho.server.TcpConnection.run(TcpConnection.java:140)
>         at java.lang.Thread.run(Thread.java:498)
> 
> 
> What am I doing wrong?

I'm not familiar with Resin, but it looks like your
JSP engine is missing a feature.  If you look at the
Javadocs for Resin:

 
http://www.caucho.com/products/resin/javadoc/javax/servlet/jsp/tagext/TagData.html

it is missing the getAttributes() method proscribed by
the Servlet 2.2 API:

 
http://java.sun.com/products/servlet/2.2/javadoc/javax/servlet/jsp/tagext/TagData.html

Solution: if you're familiar enough with Servlets and
tag libraries, you could download the current CVS,
remove the isValid() method from the BaseGetterTEI
class, and build your own version of the tag.  Just
keep an eye on your usage, since that method performs
valuable validation of the "colName" and "position"
attributes of the getter tags.

> 
> The other problem that I ran across was that the
> documentation showed
> the connection attribute would work as:
> 
> 	<sql:connection id="conn1"
> jndiName="java:comp/env/jdbc/advdb">
> 
> but that gets me an error about an unknown attribute
> "jndiname" (yes,
> the 'n' switched case).  Change the connection tags
> to:
> 
> 	<sql:connection id="conn1">
> 	
>
<sql:jndiName>java:comp/env/jdbc/advdb</sql:jndiName>
> 	</sql:connection>
> 
> gets it working correctly.  Tried both the 3/16 and
> 3/17 nightlies just
> to see if it was a bug that'd been ironed out since
> my download.

Good catch.  I introduced an error when I changed the
capitalization of the jndiName attribute.  It should
work after tonight's build, or feel free to build it
from source.

> Thanks for any help you can provide!
> 
> -- 
> Steve Philp, MCSE/MCP+I
> Assistant IS Manager
> Advance Packaging Corporation
> sphilp@ameritech.net


=====
Morgan Delagrange
Britannica.com

__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/

Mime
View raw message