About Question enthuware.jwpv6.2.1129 :

Moderator: admin

Post Reply
himaiMinh
Posts: 358
Joined: Fri Nov 29, 2013 8:26 pm
Contact:

About Question enthuware.jwpv6.2.1129 :

Post by himaiMinh »

To my surprise, the location start with / works with my Tomcat 8.

Code: Select all

//web.xml
<web-app>
     
    <jsp-config>
         <taglib>
              <taglib-uri>/binomial</taglib-uri>
              <taglib-location>/lib/MathLib.jar</taglib-location>
          </taglib>   
        </jsp-config>
</web-app>

Code: Select all

//In index.jsp
<body>
        <%@taglib prefix="bi" uri="/binomial"%>
        <bi:currentDate/>
        
    </body>
I have a MathLib.jar in the lib directory. The tld is

Code: Select all

<taglib version="2.1" xmlns="http://java.sun.com/xml/ns/javaee" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd">
 
 <tlib-version>1.0</tlib-version>
  <short-name>mytld</short-name>
 <uri>/binomial</uri>
  <tag>
        <name>currentDate</name>
   <tagclass>com.tags.CurrentDateTag</tagclass>
   <info>Returns the current date with the SHORT date format</info>
   <body-content>empty</body-content>
 </tag>
</taglib>
I guess the web container automatically searches for the jar file in the lib directory.
The taglib is optional in web.xml with the new web container.

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.1129 :

Post by admin »

You should test this on a version of tomcat that implements EE 6 and not EE7 and see what happens.
-Paul.
If you like our products and services, please help us by posting your review here.

himaiMinh
Posts: 358
Joined: Fri Nov 29, 2013 8:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.1129 :

Post by himaiMinh »

Hi, Paul. Thanks for your suggestion.
I used Tomcat 6.0.45 with <taglib-location>/lib/MathLib.jar</taglib-location>.
It gives me error:
Exception report
message Unable to initialize TldLocationsCache: null
description The server encountered an internal error that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to initialize TldLocationsCache: null ...

Post Reply

Who is online

Users browsing this forum: No registered users and 20 guests