Newb taglib conceptual error: Missing tagclass for tag "dbgrid"

G

geoffalot

Newb Taglib conceptual error:
"Missing tagclass for tag 'dbgrid'"

I am attempting to integrate a datagrid taglib into a small test
application.

The Datagrid lives here:
http://www.codeproject.com/useritems/DBGrid.asp?df=100&forumid=82119&fr=26

My .jsp starts with the following:

<%@ taglib uri="/WEB-INF/tags/datagrid.tld" prefix="grd" %>

<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.DriverManager" %>
<%@ page import="java.sql.SQLException" %>
<%@ page import="com.freeware.gridtag.*" %>


The taglib section from my web.xml looks like this:

<taglib>
<taglib-uri>/tags/datagrid.tld</taglib-uri>
<taglib-location>/WEB-INF/tags/datagrid.tld</taglib-location>
</taglib>

(The file datagrid.tld definitely lives under /WEB-INF/tags)


My datagrid taglib descriptor starts like this:

<taglib>
<tlib-version>1.0</tlib-version>
<jsp-version>1.2</jsp-version>
<short-name>DBGrid</short-name>
<display-name>DBGrid</display-name>
<small-icon>images/dbGridS.gif</small-icon>
<large-icon>images/dbGridM.gif</large-icon>
<description>JSP Data Grid Tag Library</description>

<tag>
<name>dbgrid</name>
<tag-class>com.freeware.gridtag.DBGrid</tag-class>


The error I am receiving on the jsp is:
dg.jsp Line 1: Missing tagclass for tag "dbgrid"

In the .jsp, I can import all the classes in datagrid.tld with "@ page
import" directives, but something I am doing wrong is making it
impossible to for the application to "see" the tagclasses via a
taglib.

If it matters - I am running this on Blazix.

Any help greatly appreciated.

Geoff
 
A

angrybaldguy

geoffalot said:
Newb Taglib conceptual error:
"Missing tagclass for tag 'dbgrid'"

Which means the web app can't locate the class for that tag. Imports
have nothing to do with it; you'll need to either include the taglib
JAR in WEB-INF/lib or include the classes in WEB-INF/classes, or
otherwise make the DataGridTag classes and their dependencies
available to the web app's classloader.
 
G

geoffalot

Which means the web app can't locate the class for that tag. Imports
have nothing to do with it; you'll need to either include the taglib
JAR in WEB-INF/lib or include the classes in WEB-INF/classes, or
otherwise make the DataGridTag classes and their dependencies
available to the web app's classloader.

I have the dbgrid-1.0.4.jar in the WEB-INF/lib directory, which is why
this is so vexxing to me :)
When you say "imports have nothing to do with it" - does that mean
even though a class is available via an import, it isn't necessarily
visible to the web application context?
 
L

Lew

When you say "imports have nothing to do with it" - does that mean
even though a class is available via an import, it isn't necessarily
visible to the web application context?

That is correct. In fact, an "import" is necessarily not visible at runtime.

Bear in mind that "import" does not exist in the bytecode; it is a convenience
for the compiler only. What exists in the bytecode is a fully-qualified class
name every time.

At the (run-) time of first use, a class must be "brought in" to the JVM.
This is done through a ClassLoader. If the ClassLoader cannot find the class,
there is a runtime error. (Runtime errors can never have anything to do with
"import" because "import" is a compile-time concept.)

For a web app, the ClassLoader class path is as angrybaldguy described.

All "import" does is, in effect, a text translation of an unqualified class
name to a fully-qualified class name. It does nothing to guarantee runtime
availability of that fully-qualified class.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top