File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes JSTL Core Taglib error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "JSTL Core Taglib error" Watch "JSTL Core Taglib error" New topic
Author

JSTL Core Taglib error

Bai Shen
Ranch Hand

Joined: Sep 24, 2008
Posts: 323
I have a feeling I'm missing something simple, but I can't seem to figure out what. I'm running Tomcat 6 in Eclipse. I have a JSP and have the taglib at the top of the file, between DOCTYPE and HTML.



I keep getting the following error.


I tried copying the jstl.jar into my lib dir, but that didn't fix it. And the line was taken from the Java EE 5 tutorial.

Anybody know what the correct uri is, or what I'm doing wrong? Thanks.
Mark E Hansen
Ranch Hand

Joined: Apr 01, 2009
Posts: 650
Which lib directory did you copy the file to? I have 'jstl-1.2.jar' placed in the lib directory of my JBoss installation, and don't have any problems. Are you sure the 'lib' directory into which you copied the Jar is on the web application's class path?
Bai Shen
Ranch Hand

Joined: Sep 24, 2008
Posts: 323
Mark E Hansen wrote:Which lib directory did you copy the file to? I have 'jstl-1.2.jar' placed in the lib directory of my JBoss installation, and don't have any problems. Are you sure the 'lib' directory into which you copied the Jar is on the web application's class path?


I got it fixed. Apparently Tomcat doesn't ship with jstl 1.2 So I had to download jstl-impl-1.2.jar and place it in WEB-INF/lib along with jstl.jar and then everything worked. Not sure why the jstl.jar file is in the examples webapp and not the common lib dir.
Mark E Hansen
Ranch Hand

Joined: Apr 01, 2009
Posts: 650
Bai Shen wrote:
Mark E Hansen wrote:Which lib directory did you copy the file to? I have 'jstl-1.2.jar' placed in the lib directory of my JBoss installation, and don't have any problems. Are you sure the 'lib' directory into which you copied the Jar is on the web application's class path?


I got it fixed. Apparently Tomcat doesn't ship with jstl 1.2 So I had to download jstl-impl-1.2.jar and place it in WEB-INF/lib along with jstl.jar and then everything worked. Not sure why the jstl.jar file is in the examples webapp and not the common lib dir.


You should probably go back and double check what you have. I know that prior to JSTL 1.2, you needed two jar files. With JSTL 1.2, you only need one (jstl-1.2.jar). See the following from the Java Ranch JSP FAQ: http://faq.javaranch.com/java/SetupJstlForJsp2
Bai Shen
Ranch Hand

Joined: Sep 24, 2008
Posts: 323
Mark E Hansen wrote:You should probably go back and double check what you have. I know that prior to JSTL 1.2, you needed two jar files. With JSTL 1.2, you only need one (jstl-1.2.jar). See the following from the Java Ranch JSP FAQ: http://faq.javaranch.com/java/SetupJstlForJsp2


Well, I originally only added the jstl-1.2.jar file, but then I got a ClassNotFoundException, and when I did a search for that class, it was only found in the jstl.jar.
Mark E Hansen
Ranch Hand

Joined: Apr 01, 2009
Posts: 650
Bai Shen wrote:
Mark E Hansen wrote:You should probably go back and double check what you have. I know that prior to JSTL 1.2, you needed two jar files. With JSTL 1.2, you only need one (jstl-1.2.jar). See the following from the Java Ranch JSP FAQ: http://faq.javaranch.com/java/SetupJstlForJsp2


Well, I originally only added the jstl-1.2.jar file, but then I got a ClassNotFoundException, and when I did a search for that class, it was only found in the jstl.jar.

Then something is not configured properly. You only need the one Jar, jstl-1.2.jar
Bai Shen
Ranch Hand

Joined: Sep 24, 2008
Posts: 323
Mark E Hansen wrote:
Bai Shen wrote:Well, I originally only added the jstl-1.2.jar file, but then I got a ClassNotFoundException, and when I did a search for that class, it was only found in the jstl.jar.

Then something is not configured properly. You only need the one Jar, jstl-1.2.jar


Well, whenever I remove the jstl.jar I get the following CNFE. javax.servlet.jsp.jstl.core.ConditionalTagSupport

When I do a search, it's not found in the jstl-1.2.jar
Mark E Hansen
Ranch Hand

Joined: Apr 01, 2009
Posts: 650
Bai Shen wrote:Well, whenever I remove the jstl.jar I get the following CNFE. javax.servlet.jsp.jstl.core.ConditionalTagSupport

When I do a search, it's not found in the jstl-1.2.jar


That's strange, it's in the jstl-1.2.jar file I downloaded recently. Perhaps you're Jar file is corrupted? A link for downloading can be found on the Jstl Tag Lib Definitions page at Java Ranch: http://faq.javaranch.com/java/JstlTagLibDefinitions I'm pretty sure this is how I found the Jar file for download.

Have a look at the Java Ranch FAQ on setting up for JSTL: http://faq.javaranch.com/java/SetupJstlForJsp2
Perhaps you're Servlet version is not at least 2.5 (a requirement to use JSTL 1.2) or one of the other prerequisites mentioned there are not met?

Best Regards,
Bai Shen
Ranch Hand

Joined: Sep 24, 2008
Posts: 323
Mark E Hansen wrote:That's strange, it's in the jstl-1.2.jar file I downloaded recently. Perhaps you're Jar file is corrupted? A link for downloading can be found on the Jstl Tag Lib Definitions page at Java Ranch: http://faq.javaranch.com/java/JstlTagLibDefinitions I'm pretty sure this is how I found the Jar file for download.

Have a look at the Java Ranch FAQ on setting up for JSTL: http://faq.javaranch.com/java/SetupJstlForJsp2
Perhaps you're Servlet version is not at least 2.5 (a requirement to use JSTL 1.2) or one of the other prerequisites mentioned there are not met?

Best Regards,


I just redownloaded the file from https://jstl.dev.java.net/download.html which is where I got it originally and where the link in the FAQ takes me. Neither copy has that file in it. The size is 383KB (392,431B) and the size on disk is 384KB (393,216B).

Opening up the file, it only has org.apache classes in it. Nothing from javax.
Bai Shen
Ranch Hand

Joined: Sep 24, 2008
Posts: 323
Ah, I found the problem. I needed to download the api jar as well. I never clicked on it 'cause I thought it was just the javadocs. So you need jstl-api-1.2.jar and jstl-impl-1.2.jar
Mark E Hansen
Ranch Hand

Joined: Apr 01, 2009
Posts: 650
Now I'm quite confused. When I downloaded the library (mid January), there was only the one Jar, named jstl-1.2.jar
It definitely works, and all the necessary classes are there.

However, in looking at the Jstl Tag Lib Definitions page at Java Ranch, it says two jars are required: jstl-impl-1.2.jar and jstl-api-1.2.jar.
In looking at those jar files, it indeed looks like you need both.

On the other hand, in the Setup Jstl for Jsp2 page on Java Ranch, it still says that for JSTL 1.2, you only need the one jar, named jstl-1.2.jar, which is what I have.

I wonder if the packaging for the library has changed recently? I guess the Java Ranch FAQ needs to be updated, if that is the case.

Otherwise, I can't explain it. It looks like for JSTL 1.2, you need the following two jars (these are different jars than what was used for previous versions): jstl-impl-1.2.jar and jstl-api-1.2.jar
Mark E Hansen
Ranch Hand

Joined: Apr 01, 2009
Posts: 650
Bai Shen wrote:Ah, I found the problem. I needed to download the api jar as well. I never clicked on it 'cause I thought it was just the javadocs. So you need jstl-api-1.2.jar and jstl-impl-1.2.jar

Well, you didn't need two Jar files 4 weeks ago, but it seems it's you do today
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61772
    
  67

Yup, looks like the Glassfish (Sun) implementation has changed from one file to two. I've updated the FAQs accordingly.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSTL Core Taglib error