This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

new to JSTL

 
gino mendoza
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm new and starting to elarn JSTL.
I followed a sample I saw on the web. The first 2 lines of the page has the following:
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
The error I get when I access the page is:
Internal Servlet Error:
org.apache.jasper.compiler.CompileException: /opt/www/corp/apova/java/apova/Apova3.jsp(1,0) Unable to open taglibrary http://java.sun.com/jstl/fmt : Could not locate TLD http://java.sun.com/jstl/fmt

---------------
Are these links stil valid?
http://java.sun.com/jstl/fmt
http://java.sun.com/jstl/core
I tried them but I get the SUN page not found.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65227
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
They are not links, they are simply URIs that are used to identify the tag libraries. They could just as easily have been "askjdhadasjdhkajhkdaskjahjh", but the format chosen for the id's were of the URI format.
The cause of your error is that the TLDs identified by the URIs cannot be located by the servlet container. Did you put the JSTL jar files somewhere where the container can find them? The JSTL TLD files are in the JSTL jar files.
This, by the way, is something common to all tag libraries, not just the JSTL.
 
gino mendoza
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wen tto: http://java.sun.com/products/jsp/jstl/ to grab the jslt.ajr file.
What I got was a fiel called: jstl-1_1-mr2-api.jar
Is this the same?
I have put that file in the WEB-INF/lib folder, and am still getting the error.
I read in soem sites to get the standard.jar file, but I've been searching and cannot find it. Do I need this file?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65227
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you need both files. The jstl jar file only has a handful of the classes and no TLD files.
I think you'd be better off downloading the Jakarta implementation of the JSTL from http://jakarta.apache.org/taglibs/doc/standard-doc/intro.html
Be sure to get both the jstl.jar and standard.jar files, and place them appropriately.
The TLDs are in the standard.jar file, by the way.
[ May 06, 2004: Message edited by: Bear Bibeault ]
 
gino mendoza
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, I wen tto the site you mentioned.
I followed some links and got to: http://cvs.apache.org/builds/jakarta-taglibs/nightly/
I grabed the fiel called jakarta-taglibs-20040506.zip, and in it were 2 jstl.jar files, and 2 standard.jar files.
I grabbed the 2 jar files that are in jakarata-taglibs\standard\lib (instead of the files in jakarata-taglibs\standard-1.0\lib)
Still getting the error.
First of all, did I grab the right files?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65227
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should be able to tell by opening the jar files and peeking inside. Find the TLD files and make sure that the URI's match up.
Be sure you down-loaded the correct version of the JSTL. The URIs you listed are for JSTL 1.0.
Btw, you should be using JSTL 1.0 if you are using a JSP 1.2 container, and JSTL 1.1 if using a JSP 2.0 container.
 
gino mendoza
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wen tto: http://java.sun.com/products/jsp/jstl/ to grab the jslt.ajr file.
What I got was a fiel called: jstl-1_1-mr2-api.jar
Is this the same?
I have put that file in the WEB-INF/lib folder, and am still getting the error.
I read in soem sites to get the standard.jar file, but I've been searching and cannot find it. Do I need this file?
 
gino mendoza
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I verified the tld files.
How do I know what JSP container I have?
 
gino mendoza
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I verified the c.tld and fmt.tld files - they look OK, i.e., they say:
<uri>http://java.sun.com/jstl/core</uri>
<uri>http://java.sun.com/jstl/fmt</uri>
I have a JSP 1.2 container.
My 2 jar files are in WEB-INF/lib
Still getting the error.
What else am I missing?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65227
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmm, that should work -- "shuold" be the operative word here.
I have heard that some JSP 1.2 containers (some versions of Tomcat 4, for example) are a bit inconsistent about locating TLDs automatically. (Tomcat 5, a JSP 2.0 container, exhibits no such problems that I have experienced).
The brute-force approach would be to add the TLD<->URI associations to the web.xml file. At the very least, if that works, it would show that you've got everything else set up ok.
 
gino mendoza
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
now here's what I did
- put c.tld and fmt.tld under WEB-INF/tld
in the jsp file I have:
<%@ taglib uri="jstl/c" prefix="c" %>
<%@ taglib uri="jstl/fmt" prefix="fmt" %>
in my web.xml file I have:
<taglib>
<taglib-uri>jstl/c</taglib-uri>
<taglib-location>/WEB-INF/tld/c.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>jstl/fmt</taglib-uri>
<taglib-location>/WEB-INF/tld/fmt.tld</taglib-location>
</taglib>

Here is the error I get now:
org.apache.jasper.compiler.CompileException: /opt/www/corp/apova/java/apova/Apova3.jsp(1,0) Unable to open taglibrary jstl/c : Parse Error in the tag library descriptor: External entity not found: "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd".
Any ideas?
 
gino mendoza
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You said earlier:
Btw, you should be using JSTL 1.0 if you are using a JSP 1.2 container, and JSTL 1.1 if using a JSP 2.0 container.
Just realized my server info is as follows:
SERVER INFO : Tomcat Web Server/3.2.4 (JSP 1.1; Servlet 2.2; Java 1.3.1.01-release; HP-UX B.11.00 PA_RISC; java.vendor=Hewlett-Packard Co.)
So what JSTL should I use?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65227
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh my, that is an ancient version of Tomcat. I would at least upgrade to a Tomcat 4 instance and preferably Tomcat 5 so you get the advantages of a JSP 2.0 container.
 
gino mendoza
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unfortunately that is not under my control. that is in our test environment and another group controls that.
Is that why I'm getting the error?
What can I use with this verison of tomcat?
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your ancient JSP engine predates JSTL, meaning you can't use it at all.
Get your server admin to upgrade to Tomcat 4.1 or 5.0 and use the appropriate jstl for that (1.0 and 1.1 respectively).
While you're at it, get them to upgrade the J2SDK to 1.4 as well.
Simple reasons: performance and security are better (those always work to get those lazy buggers on their feet).
 
gino mendoza
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assuming I'm constrained to what I have now, is there anything else I can use to display static elements in my JSP application in different languages (English ro French)?
Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65227
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are restricted to using stone knives and bearskins, you should considered writing your own set of custom actions that mimic what the JSTL fmt tags would have done for you.
Seems kind of silly though to be putting all that effort in. What's preventing you from upgrading? A pointy-haired boss?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic