Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
    Bookmark Topic Watch Topic
  • New Topic

Problem accessing the standard tag lib.

 
Egil Hansen
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi

I'm absolutely new to JSP and I'm struggelig to get some example programs running.
I use Tomcat 6.0.18 with Firefox 3.0.7. I've loaded the standard taglibs from the Sun site into C:\Java\jakarta-taglibs-standard-1.1.2\lib
and placed the two *.jar files on my CLASSPATH:
CLASSPATH=C:\Java\jakarta-taglibs-standard-1.1.2\lib\jstl.jar;C:\Java\jakarta-taglibs-standard-1.1.2\lib\standard.jar

The first line af my *.jsp file reads:
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>

When I run it I get a dump:
org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application

What am I doing wrong?

Thanks in advance.

PotAsh
 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator

Hi Egi ,

Welcome to Javaranch .

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

Check out this for details Javaranch FAQ
 
Egil Hansen
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Report post to moderator
Balu Sadhasivam wrote:
Hi Egi ,

Welcome to Javaranch .

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

Check out this for details Javaranch FAQ


Thank you for your welcome.
I did as directed, but the result is still the same. A stack dump.
 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator


Egil,

Did you read that link completely. Tomcat 6 uses JSP2.1 complaint container, so i guess you should use JSTL 1.2 as directed in the link.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Report post to moderator
You need to put it in the webapp's classpath, not the CLASSPATH environment variable. The CLASSPATH environment variable is only used when you manually execute javac.exe or java.exe without the -cp, -classpath or -jar arguments.

The webapp's default classpath covers the /WEB-INF/lib. Place the webapp related JAR files in there.
 
Egil Hansen
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Report post to moderator
I downloaded the jstl-1.2.jar file and placed it in the /WEB-INF/lib folder.

C:\Tomcat 6.0\webapps\RequestHeaders\WEB-INF\lib

<DIR> .
<DIR> ..
414.240 jstl-1.2.jar
16.905 jstl.jar
293.750 standard.jar
3 fil(er) 724.895 byte

Also I changed the taglib directive like this
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl-1.2/core" %>

Same result: Stack dump.

 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Report post to moderator
The upgrade is not needed, the taglib URI is completely wrong and you forgot to remove the standard.jar.

Please read the aforementioned JSP FAQ.
 
Egil Hansen
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Report post to moderator
There is a space in the directory name where tomcat is installed: C:\Tomcat 6.0
Could that be a problem?

 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Report post to moderator
OK, I give up.
 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator


There is a space in the directory name where tomcat is installed: C:\Tomcat 6.0
Could that be a problem?


That shouldnt be a problem. OK do the whole exercise again . just adding only the required jar files(jstl1.2) to CLASSPATH and as well as in the lib directory. ( remove old jars)

Also as Bauke mentioned URI is wrong and use the one from FAQ
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Report post to moderator
No, there is no "as well as". The CLASSPATH environment variable is completely ignored by the appserver.

Read the JSP FAQ. Clearly ignoring it won't generate helpful answers from my side.
 
Egil Hansen
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Report post to moderator
Bauke Scholtz wrote:The upgrade is not needed, the taglib URI is completely wrong and you forgot to remove the standard.jar.

Please read the aforementioned JSP FAQ.


Hi.
I installed the jstl-1.2.jar file and removed the other two.
It still does not work. In what way is the URI wrong? I see no directions in the FAQ regarding JSTL.1.2.

rgds.
PotAsh
 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator


Hi.
I installed the jstl-1.2.jar file and removed the other two.
It still does not work. In what way is the URI wrong? I see no directions in the FAQ regarding JSTL.1.2.

rgds.
PotAsh


Post the recent error. and URI used.
 
Egil Hansen
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Report post to moderator
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl-1.2/core" %>

org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsp/jstl-1.2/core cannot be resolved in either web.xml or the jar files deployed with this application

 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator


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


where jstl-1.2 in URI comes from ? Whats the URI in FAQ , its mere jsp/jstl . check again in FAQ
 
Egil Hansen
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Report post to moderator
I see nothing in the FAQ regarding the URI for v.1.2.
If I use the URI specified for v.1.1 (<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>), I get:

org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application

Please bear with me. I'm absolutely new to JSP.

rgds
PotAsh
 
Egil Hansen
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Report post to moderator
Thank you gentlemen for your kind help.
Now it runs.

I copied the jstl-1.2.jar to jstl.jar and used the URI given for v.1.1.
Then I had to restart the browser. It seems that Firefox does some kind of buffering that interferes with the "logical" workings of the browser.

Rgds.
Egil
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65110
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
I edited this thread to remove all the irrelevant posts about over-riding the CLASSPATH -- what nonsense!
 
    Bookmark Topic Watch Topic
  • New Topic