You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Kevin Jones <ke...@develop.com> on 2000/03/06 15:39:37 UTC

Compiled JSPs and taglibs

I have a JSP page (Simple.jsp) that references a tag library
(simpletags.tag as <%@ taglib uri="/simpletags.jar" prefix="simple" %>. I
put the tag lib in WEB-INF/lib and browse to the page, everything works as
expected. However, if I compile the jsp page to a servlet and try and access
the page either through /servlet/Simple, or throught Simple.jsp with the
correct mapping in web.xml, I get a NoClassDefFoundError, for a class
defined in the simpletags.jar.

Is the classpath used for servlets different from the classpath used for
JSPs, i.e. the taglib jar files don't appear to be on the servlet classpath,

Kevin Jones
www.develop.com


Re: Compiled JSPs and taglibs

Posted by Danno Ferrin <sh...@earthlink.net>.
When you specify a uri that is a jar for a taglib, the uri actually
needs to be accessible from that address and not just in the lib
directory.  No HTTP resources are mapped to any entry in the libs
directory, so the file simpletag.jar needs to be at the root directory,
which is always parallel to the WEB-INF directory.  i.e. a jar specified
as the uri must be an actual web document.

--Danno

Kevin Jones wrote:
> 
> I have a JSP page (Simple.jsp) that references a tag library
> (simpletags.tag as <%@ taglib uri="/simpletags.jar" prefix="simple" %>. I
> put the tag lib in WEB-INF/lib and browse to the page, everything works as
> expected. However, if I compile the jsp page to a servlet and try and access
> the page either through /servlet/Simple, or throught Simple.jsp with the
> correct mapping in web.xml, I get a NoClassDefFoundError, for a class
> defined in the simpletags.jar.
> 
> Is the classpath used for servlets different from the classpath used for
> JSPs, i.e. the taglib jar files don't appear to be on the servlet classpath,
> 
> Kevin Jones
> www.develop.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org