Forums Register Login

can't run jstl in jsp

+Pie Number of slices to send: Send
I am trying to use jstl in my jsp page but its giving hte following error.



i have copied jstl.jar in my webapps lib directory.
Here is my jsp file


here is my servlet


thanks
+Pie Number of slices to send: Send
here is my web.xml


[ October 27, 2004: Message edited by: Angela lewis ]

There is no tld file in jstl.jar
[ October 27, 2004: Message edited by: Angela lewis ]
+Pie Number of slices to send: Send
+Pie Number of slices to send: Send
 

Originally posted by Nitish Bahadur:
This might help http://java.about.com/library/weekly/aa_jstl_intro_2.htm



It has mentioned anything abt changes to be made in web.xml. If i don't make any changes in web.xml still get the same error.
Surprisingly there's no mention of changes of changes in wex.xml for using jstl in HF Servlets and JSP.
Is it needed or not?
+Pie Number of slices to send: Send
I hadn't copied standard.jar in teh lib. i did that and now i am getting the follwoing error


javax.servlet.ServletException: javax.servlet.jsp.tagext.TagAttributeInfo.<init>(Ljava/lang/String;ZLjava/lang/String;ZZ)V
+Pie Number of slices to send: Send
java.lang.NoSuchMethodError: javax.servlet.jsp.tagext.TagAttributeInfo.<init>(Ljava/lang/String;ZLjava/lang/String;ZZ)V
+Pie Number of slices to send: Send
Angela:

I am not sure what problem is in your code.
But having both jstl.jar and standar.jar in WEB-INF\lib directory of your web app should make JSTL work.

Here is what I tried, just one JSP with scriptlet, and it works.(I did not put anything in my web.xml about JSTL)

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html><body>
<strong> Movie List: </strong>
<br><br>

<% String[] movieList={"Lion King", "Harry Potter", "Hero"};
request.setAttribute("movieList", movieList); %>

<table>
<c:forEach var="movie" items="${movieList}" >
<tr>
<td>${movie}</td>
</tr>
</c:forEach>
</table>

</body></html>

You can try this to see if it works.
+Pie Number of slices to send: Send
Angela:

It looks like you need to remove whatever you add to web.xml to declare the tld since that is not necessary. (see HFS page 475 for explanation)

Secondly, look at your html code, you mistyped closing tag to be <c:forEach> instead of </c:forEach>

--Jessica
+Pie Number of slices to send: Send
 

Originally posted by Jessica White:
Angela:

It looks like you need to remove whatever you add to web.xml to declare the tld since that is not necessary. (see HFS page 475 for explanation)

Secondly, look at your html code, you mistyped closing tag to be <c:forEach> instead of </c:forEach>

--Jessica



Thanks jessica for replying.
I have corrected the <c:forEach> tag. Deleted the entry from web.xml and tried using your example but still getting this error

javax.servlet.ServletException: javax.servlet.jsp.tagext.TagAttributeInfo.<init>(Ljava/lang/String;ZLjava/lang/String;ZZ)V
+Pie Number of slices to send: Send
I think there is some other problem.
None of the build in JSP 2.0 examples under jsp-examples directory are running. But JSP 1.2 examples are running fine.
please tell me what could be the problem.
+Pie Number of slices to send: Send
This is what i got when i tried to execute one the inbuild JSP2.0 examples under jsp-examples

java.lang.NoSuchMethodError: javax.servlet.jsp.PageContext.getVariableResolver()Ljavax/servlet/jsp/el/VariableResolver;
+Pie Number of slices to send: Send
Curiosity, what version of Tomcat are you running?
+Pie Number of slices to send: Send
You will need both jstl.jar and standard.jar and need Tomcat 5.x
+Pie Number of slices to send: Send
 

Originally posted by Colin Fletcher:
You will need both jstl.jar and standard.jar and need Tomcat 5.x



I am using Tomcat 5.0 and I am only trying to run the inbuild examples under jsp-examples (both the jar files are available there) at this url

http://localhost:8080/jsp-examples
+Pie Number of slices to send: Send
 

Originally posted by Nitish Bahadur:
Curiosity, what version of Tomcat are you running?



Only Tomcat 5 has inbuild jstl examples under jsp-examples. Had it been an earlier version there wouldn't have been inbuild jstl examples. I tried making my own jsp pages using jstl but there is the same error as there is while executing inbuild jstl examples.
+Pie Number of slices to send: Send
I have uninstalled and reinstalled tomcat a number of times. Even tried using the beta version jakarta-tomcat-5.0.29 but no use. Same error everywhere.
Did it on another machine also but same problem there. I wonder why no one else faced this problem.
+Pie Number of slices to send: Send
this is the exact error i get

exception

javax.servlet.ServletException: Error instantiating servlet class org.apache.jsp.jsp2.tagfiles.hello_jsp
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
java.lang.Thread.run(Thread.java:536)


root cause

java.lang.VerifyError: (class: org/apache/jsp/jsp2/tagfiles/hello_jsp, method: _jspx_meth_tags_helloWorld_0 signature: (Ljavax/servlet/jsp/PageContext Z) Incompatible argument to function
java.lang.Class.getDeclaredConstructors0(Native Method)
java.lang.Class.privateGetDeclaredConstructors(Class.java:1590)
java.lang.Class.getConstructor0(Class.java:1762)
java.lang.Class.newInstance0(Class.java:276)
java.lang.Class.newInstance(Class.java:259)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
java.lang.Thread.run(Thread.java:536)


note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.

 
+Pie Number of slices to send: Send
What is your JAVA_HOME set to? Can you please tell us the java version Tomcat is using?
+Pie Number of slices to send: Send
Angela,

I am using Tomcat 5.0.29 with JDK 1.4.2 and works for me... I agree with the last post. I would double check your Java version....
+Pie Number of slices to send: Send
the problem was jbuilder8. There must be some old binaries which were conflicitng with new JSP2,0 binaries. I uninstalled Jbuilder is its working fine now
thanks everyone
+Pie Number of slices to send: Send
Hi..Even I am facing the same problem...JSP 2.0 examples are not working on my system but JSP1.2 examples are.Moreover,if I use formbean in struts it gives me the same error..Can anyone help..ITS URGENT...
+Pie Number of slices to send: Send
I'm using IntelliJ IDEA and had the same problems.
I was switching project settings a lot and at one time it stopped working.
I then created new project space from scratch and it worked normally again.
+Pie Number of slices to send: Send
If you are getting the wrong method signature exception on TagAttributeInfo
it means you have got down-level javax.servet code. You might consider
a "nuke and pave" reinstall (just get the latest from the Sun site). But
if you're like me, you have some other environment (for me it was JBoss).

I was able to find that the
TagAttributeInfo class resides in jsp-api.jar (that comes with the
JBoss install) as well as j2ee.jar, that comes with Sun's j2ee.

The solution was to jar-up only the javax.servlet classes from j2ee.jar,
and put that subset jar in the JBOSS_HOME environment variable. Works like
a charm now. Google drs.usenet and TagAttributeInfo for details.

--Dale--
[ November 26, 2004: Message edited by: Dale Seng ]
money grubbing section goes here:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 4835 times.
Similar Threads
how to get jstl working
c:forEach tag
JSTL pg 437 HFSJ
JSTL does not show values
Using JSTL example in K&B Book
Why should you try IntelliJ IDEA ?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 02:08:49.