[EMAIL PROTECTED] wrote: > ... > As soon as I put the <taglib> definitions back into > <TOMCAT_HOME>/webapps/standard-examples/WEB-INF/web.xml, everything works > fine again. Now, from my understanding, either a tag library works or > it doesn't... does anyone have a clue what might be the problem?
This does not work because Tomcat (more specifically Jasper, the JSP engine in Tomcat) does not process the taglib directives that are included in <tomcat>/conf/web.xml. It could be argued that this is a bug in tomcat, since <tomcat>/conf/web.xml states the following: <!-- This document defines default values for *all* web applications --> <!-- loaded into this instance of Tomcat. As each application is --> <!-- deployed, this file is processed, followed by the --> <!-- "/WEB-INF/web.xml" deployment descriptor from your own --> <!-- applications. --> According to this, one could assume (as you did) that TLD mappings in <tomcat>/conf/web.xml augment the ones defined in the web.xml of the webapp. But it is not currently done this way in Tomcat, and this is why it failed to work for you. Being able to share tag libraries globally is definitely of interest. But as you have experimented, the way to do it properly is not as straightforward as it should be. I have discussed the topic with people involved with Tomcat development, and following these discussions I have filed an RFE to help simplify the process of sharing tag libraries globally in Tomcat. The RFE may be viewed at http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15875 -- Pierre [EMAIL PROTECTED] wrote: > > Hi > > I've installed Tomcat 4.1.18 now and the first thing I usually do is test > the tag libraries. Since I don't want to have a web.xml file for each and > every webapp, I put the taglib definitions into <TOMCAT_HOME>/conf/web.xml > and also strip out anything I don't want. > > Specifically it looks like this (including the String taglib): > ... > <taglib> > > <taglib-uri>http://jakarta.apache.org/taglibs/string-1.0</taglib-uri> > <taglib-location>/WEB-INF/string.tld</taglib-location> > </taglib> > <taglib> > <taglib-uri>http://java.sun.com/jstl/core</taglib-uri> > <taglib-location>/WEB-INF/c.tld</taglib-location> > </taglib> > <taglib> > <taglib-uri>http://java.sun.com/jstl/fmt</taglib-uri> > <taglib-location>/WEB-INF/fmt.tld</taglib-location> > </taglib> > <taglib> > > <taglib-uri>http://jakarta.apache.org/taglibs/standard/scriptfree</taglib-ur > i> > <taglib-location>/WEB-INF/scriptfree.tld</taglib-location> > </taglib> > ... > > So I downloaded JSTL 1.0.2, put the JAR files into <TOMCAT_HOME>/shared/lib > and then unpacked standard-examples.jar, deleting the > <TOMCAT_HOME>/webapps/standard-examples/WEB-INF/lib at the same time. > Everything worked fine. Next I deleted the TLDs that I didn't want, also > removing them from <TOMCAT_HOME>/webapps/standard-examples/WEB-INF/web.xml - > everything still worked fine. > > Next I removed all the taglib definitions from > <TOMCAT_HOME>/webapps/standard-examples/WEB-INF/web.xml, since the ones I > wanted were defined anyway (see above), and just a couple of TLDs remained > in <TOMCAT_HOME>/webapps/standard-examples/WEB-INF: > c.tld > fmt.tld > scriptfree.tld > string.tld > > Now the strange part starts: Some of the example pages don't work, they give > me > org.apache.jasper.JasperException: This absolute uri > (http://java.sun.com/jstl/core) cannot be resolved in either web.xml or the > jar files deployed with this application > at > org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler. > java:105) > at > org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:430 > ) > at > org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:154 > ) > at > org.apache.jasper.compiler.TagLibraryInfoImpl.(TagLibraryInfoImpl.java:159) > at > org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:354) > at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:381) > at org.apache.jasper.compiler.Parser.parseElements(Parser.java:800) > at org.apache.jasper.compiler.Parser.parse(Parser.java:122) > at > org.apache.jasper.compiler.ParserController.parse(ParserController.java:199) > at > org.apache.jasper.compiler.ParserController.parse(ParserController.java:153) > at > org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:223) > at org.apache.jasper.compiler.Compiler.compile(Compiler.java:351) > at > org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:4 > 74) > at > org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:1 > 84) > at > org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) > at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) > ... > > This happens for the following examples (I installed Tomcat on port 80): > - http://localhost/standard-examples/import/Absolute.jsp (Ok, since it uses > a non-defined taglib (jstl-examples-taglib), this should probably crash... > but why on jstl/core?) > - http://localhost/standard-examples/import/Relative.jsp > - http://localhost/standard-examples/import/Encode.jsp > - http://localhost/standard-examples/import/ExposeString.jsp > > The same happens for the fmt tags: > org.apache.jasper.JasperException: This absolute uri > (http://java.sun.com/jstl/fmt) cannot be resolved in either web.xml or the > jar files deployed with this application > at > org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler. > java:105) > at > org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:430 > ) > at > org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:154 > ) > ... > > for > > - http://localhost/standard-examples/format/GermanLocale.jsp > - http://localhost/standard-examples/format/RequestEncoding.jsp (when I > follow the links on this page) > > As soon as I put the <taglib> definitions back into > <TOMCAT_HOME>/webapps/standard-examples/WEB-INF/web.xml, everything works > fine again. > Now, from my understanding, either a tag library works or it doesn't... does > anyone have a clue what might be the problem? > > Thanks & best regards, > Eric > > P.S. I'm away till Jan. 6th, so I'll answer any questions that day. > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
