"cedric.chin" wrote:
>
> dear all,
>
> i got this error when i tried to access the jsp, and dont know what does
> the error trying to tell.
>
> org.apache.jasper.compiler.CompileException:
> C:\tomcat\webapps\ccms\testDBTag.jsp(0,0) Unable to open taglibrary
> /Web-inf/lib/login.jar : Could not locate TLD META-INF/taglib.tld
>
> i've placed my jar file which is login.jar into /web-inf/lib/
>
> in web.xml -
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <web-app>
> <taglib>
> <taglib-uri>/WEB-INF/lib/login.jar</taglib-uri>
> <taglib-location>/WEB-INF/loginvalidate.tld</taglib-location>
> </taglib>
> </web-app>
> [...]
>
> in my jsp
> <%@ taglib uri="/Web-inf/lib/login.jar" prefix="login"%>
> <login:loginValidate sessionVar="userid" redirectPage="/index.jsp" />
>
> can anyone shed some light on this?
JSP (and all other Java technologies) is case sensitive. In your web.xml
file you define the taglib URI as "/WEB-INF/lib/login.jar" but in your
JSP page you refer to it as "/Web-inf/lib/login.jar". Since the URI in
the page doesn't match what you define in the web.xml file, the container
assumes it's a path to a tag library JAR file that includes the TLD (in
META-INF/taglib.tld). Your taglib JAR file apparently does not contain
the TLD, hence the error message.
You can keep everything the same except the taglib directive. Change it
so that the URI matches the URI in the web.xml file, including case:
<%@ taglib uri="/WEB-INF/lib/login.jar" prefix="login"%>
This should work, but you may also want to consider using a symbolic
name as the URI (in the JSP pages and the web.xml file) and map it
to the actual path for the TLD in the web.xml. For deployment, you may
also want to place the TLD within the JAR file. For more on these
options, I suggest that you read the JSP specification or a book
about JSP, such as the one I wrote for O'Reilly:
<http://TheJSPBook.com/>
Hans
--
Hans Bergsten [EMAIL PROTECTED]
Gefion Software http://www.gefionsoftware.com
Author of JavaServer Pages (O'Reilly), http://TheJSPBook.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets