• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Error with JSTL tags in eclipse

 
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have Eclipse Version: 3.4.1. In my JSP's I have the following taglibs

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>

Eclipse shows a error
"Cannot find the tag library descriptor for "http://java.sun.com/jsp/jstl/core"

And i have few c:when and c:if tags. Eclipse shows
Unknown tag (c:when).

Can anyone please let me know how to get eclipse working for JSTL tags.
Thanks
Deepak
[ November 21, 2008: Message edited by: Deepak Jain ]
 
Deepak Jain
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have included standard.jar , jstl.jar into the build path of the eclispe project, I still get the same error.
Any help is appreciated.
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Adding standard.jar to the build path for your project should do it. Double-check the standard.jar that it contains the *.ltd files. Also, try closing and reopening the JSP - sometimes the editors get "stuck" and reopening the file helps.
 
Deepak Jain
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Eclipse shows a error
"Cannot find the tag library descriptor for "http://java.sun.com/jsp/jstl/core"
The above error is resolved.

I still see below errors.

And i have few c:when and c:if tags. Eclipse shows
Unknown tag (c:when).

Any help is appreciated
 
Deepak Jain
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It worked after restarting eclipse & box
The only thing one has to do is included standard.jar, jstl.jar into the build path of the eclispe project.
 
Deepak Jain
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One new problem.
I have defined a tld with few EL Functions.

1) There was no option in Eclipse to "Create a new TLD file", like "Create a new Java class file"
2) So i did it manaully. Later to use the tags defined in the TLD, in my JSPs, i defined it using taglib. There was no autocomplete when i tried to invoke the EL functions. ${prefix: functionName()} There was no autocomplete after prefix not after ${.
Is JSTL, Custom tag support limited in eclipse. If not how can one get complete support with autocomplete features.
 
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In order to get autocomplete and validation to work in Eclipse, you need to ensure that the TLD or schema is accessible under the right key by Eclipse itself (regardless of classpaths). Eclipse supports an XML catalog for such files which you should be able to find under the Preferences/XML dialog.

Some Eclipse web development bundles will have pre-cataloged TLDs/schemas for the JEE-related items. If you develop a custom TLD, you must manually catalog it.
 
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I had the same problem. my custom tags were marked as "Unknown tag"
I did not add any catalog for tld files.
I just installed the following version, then works fine.

Eclipse Version: 3.3.0
Build id: M20070921-1145

Kathir
 
Deepak Jain
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks guys.
I added the TLD file to the catalog and still there was no autocomplete after ${prefix:}
 
Kathiresan Chinna
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Deepak,

Did you try the Exclipse 3.3.0 ?
It does autocomplete.

Kathir
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I continue to get "Cannot find the tag library descriptor" errors when trying to compile with Eclipse.

Cannot find the tag library descriptor for "http://java.sun.com/jstl/core"

I am running JDK 1.4 / Tomcat 5.0 and Eclipse 3.4.2 EE, with Web Tools 2.2
I have made sure that the jstl.jar and the standard.jar are in the WEB-INF/lib. I even downloaded two new jars (JSTL 1.1) and Standard.jar and swapped them in.

These errors are at compile time. Not run time. Tomcat has nothing to do with it.

I have this exact configuration set up on my other machine and its working fine. The only difference is that this is Eclipse 3.4.2 EE version.

Any ideas how I can fix this?
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am kindof having the same problem. i am using eclipse 3.4.1 with tomcat .
Like deepak mentioned i did not find any support in eclipse for creating tld files so i created a file on my own and added it to the WEB-INF folder. here is the code -


i get the following error - XML document structures must start and end within the same directory

my jsp page is as follows


eclipse is unable to find the tld descriptor for "DiceFunctions"

i added standard.jar and jstl.jar in the build path though i dont think i need them. I also tried adding the tld to the xml catatlog but that didnt work either so if anyone knows any solution to the problem please let me know..
The code is basically taken from the head first servlets book where EL functions are described.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try this...


 
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Eclipse has a strange bug (?) when it comes to JSTL. It doesn't find the c.tld from the jstl jar (for JSTL 2.0 and on, i believe). So extract the c.tld from the jstl.jar and put it somewhere in the WEB-INF, for example in WEB-INF/tlds. The use this uri for @taglib in your jsps. You shouldn't have any problems.
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Steps to install JSTL:
1) Place the JAR file(s) in classpath. A path covered by default classpath is /WEB-INF/lib (and certainly not /WEB-INF). Place the file(s) in there.
2) Declare the JSTL taglib URI in JSP according to the JSTL version. There are 3 different URI's available. Make sure that you use the right one. Read the TLD documentation for details. Make sure that you read the right TLD for the right version.

Only those two steps are to be done. Really. Do NOT extract the JAR files and clutter the classpath or WEB-INF with loose files. Do NOT clutter the web.xml with separate tld declarations. Eclipse doesn't have any bugs related to JSTL. It's just all your own fault.

The JSP FAQ at this website contains more details such as JSTL download links and correct taglib URI's.
 
Nick Potter
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I wasn't able to use the default uri when i started a normal project (not web project).
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It was your fault that you didn't create a web project.
 
Nick Potter
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually no
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Guys guys guys

I had this terrible problem, trying to use eclipse for El, creating tld, custom tags etc. The support is horrible. (Actually there is none)

I tried something else and it rocks - netBeans.

This has all the features we want. It has excellent wizards for deployment descriptors, tlbs, custom tags etc. Give it a try.

Rgds
Swaroop
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Make sure you have the JSTL facet enabled

right-click your project/properties/Project Facets select the JSTL checkbox and version (possibly 1.1 in your case?)

Deepak Jain wrote:I have Eclipse Version: 3.4.1. In my JSP's I have the following taglibs

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>

Eclipse shows a error
"Cannot find the tag library descriptor for "http://java.sun.com/jsp/jstl/core"

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Folks,

Eclipse error "Cannot find the tag library descriptor for "http://java.sun.com/jsp/jstl/core" ideally have couple of reasons, most of them have been pointed out in the previous posts, the one and particularly important is as below. (which was actually the case with me)
Having this added in your jsp
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
even after you have jstl.jar and standard.jar in the WEB-INF/lib directory, the only reason for this is the version of these two jar's.
defining taglib in the way "<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> " is required to have these jar's of version 1.2 (which are extracted from jakarta-taglibs-standard-1.1.2.zip) unfortunately you can never know the version of these jar's from their property
defining taglib in the way "<%@ taglib uri="http://java.sun.com/jstl/core" will require 1.0 version of these jar's.
Hope it helps.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Guys

There isn't any bug in Eclipse, the problem is the order of elements. Bellow show us either two forms:

Correct
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>


Incorrect

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>


http://javecuador.blogspot.com
http://martosfre.blogspot.com
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The order of the elements in the tag doesn't matter. Both forms below are correct.

In my case, after adding standard.jar to WEB-INF/lib, Eclipse 3.5 didn't pick up the change. So, I just entered a space in the JSP file, then removed it, then saved the JSP file, and it worked. Basically, the JSP didn't change, just edit it so it's "refreshed".

Marco Antonio Toscano Freire wrote:Hello Guys

There isn't any bug in Eclipse, the problem is the order of elements. Bellow show us either two forms:

Correct
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>


Incorrect

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>


http://javecuador.blogspot.com
http://martosfre.blogspot.com

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm using eclipse 3.4. I've imported web project into the eclipse. There are few custom tag libraries.

I could not get rid of the compilation errors in the eclipse
in tld files.
ERROR:The content of element type "tag" must match
"(name,tagclass,teiclass?,bodycontent?,info?,attribute*)".

I went thru previous topics and added jstl and standard jars in the build path of eclipse. I reopened eclipse IDE and restarted my machine, it did not help.

Can you pl. help in resolving this issue.



 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Marco Antonio Toscano Freire wrote:Hello Guys

There isn't any bug in Eclipse, the problem is the order of elements. Bellow show us either two forms:

Correct
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>


Incorrect

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>


http://javecuador.blogspot.com
http://martosfre.blogspot.com



It works.... good observation.... thanks
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Nilesh Katore wrote:

Marco Antonio Toscano Freire wrote:Hello Guys

There isn't any bug in Eclipse, the problem is the order of elements. Bellow show us either two forms:

Correct
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>


Incorrect

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>


http://javecuador.blogspot.com
http://martosfre.blogspot.com



It works.... good observation.... thanks



Actually both forms are correct. The problem is Eclipse does not refresh the jsp page properly. The solution is to do what Tong Wang did.

Cheers,

Aulac
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The "correctly ordered" version changes the URLs themselves (dropping /jsp from both), and that is why the "correct" version works.
The order of the directives has nothing to do with it.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do like this:
Download jstl.jar and standard.jar from archive at: http://archive.apache.org/dist/jakarta/taglibs/standard/binaries/jakarta-taglibs-standard-1.0.1.zip

Extract these two jars from archive (present at jakarta-taglibs-standard-1.1.2.zip\jakarta-taglibs-standard-1.1.2\lib) and put into your classpath.

Now your taglib uri should match with <uri> value present in c.tld (present at jakarta-taglibs-standard-1.1.2.zip\jakarta-taglibs-standard-1.1.2\tld), which in this case is: http://java.sun.com/jsp/jstl/core

So your taglib will look like: <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
Similarly taglib uri will be: <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

Thanks
munish
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes the order doesn't matter here. Once the jstl.jar and standard.jar files are added to the "WEB-INF/lib" directory, cross check whether the Web App Libraries in your project's build path is checked in or not. Most probably, this will not be checked in and if it is the case, then select it and then build the project once again, this will solve the problem.
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was having this problem in eclipse, but only with one of my jsps. When I compared the non-working file with the others I noticed this line missing from the top of the non-working file:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

After adding that line, the error "Unknown tag (c:if)" went away.
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Guys,
You are not going to believe what I found. I had the same problem as everybody else has mentioned above. After 3 hours of trying all the solutions mentioned above and not success and almost uprooting all my hair I finally gave up on eclipse and went to netbeans and then guess what? I found some special characters in the file which I could not see in eclipse. Then I realized the tablib declaration that I had copied from some place was rich text and it put the " in some special form. It looked normal but I guess behind the scene it wasn't. Only after opening it in a different editor I could see it. Then removing th line and re-typing it directly in eclipse did the trick. Talk about wasting 3 hours of your life
But glad I could share it with you so nobody else go thru this again
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

The order of the elements in the tag doesn't matter. Both forms below are correct.

In my case, after adding standard.jar to WEB-INF/lib, Eclipse 3.5 didn't pick up the change. So, I just entered a space in the JSP file, then removed it, then saved the JSP file, and it worked. Basically, the JSP didn't change, just edit it so it's "refreshed".




Thanks Tong Wang, works for me now.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

G Par wrote:Hey Guys,
You are not going to believe what I found. I had the same problem as everybody else has mentioned above. After 3 hours of trying all the solutions mentioned above and not success and almost uprooting all my hair I finally gave up on eclipse and went to netbeans and then guess what? I found some special characters in the file which I could not see in eclipse. Then I realized the tablib declaration that I had copied from some place was rich text and it put the " in some special form. It looked normal but I guess behind the scene it wasn't. Only after opening it in a different editor I could see it. Then removing th line and re-typing it directly in eclipse did the trick. Talk about wasting 3 hours of your life
But glad I could share it with you so nobody else go thru this again



Removing one space did the trick: <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> instead of "<%@ taglib"
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic