File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can't run jstl in jsp

 
Angela lewis
Ranch Hand
Posts: 100
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Angela lewis
Ranch Hand
Posts: 100
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Nitish Bahadur
Ranch Hand
Posts: 118
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This might help http://java.about.com/library/weekly/aa_jstl_intro_2.htm
 
Angela lewis
Ranch Hand
Posts: 100
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Angela lewis
Ranch Hand
Posts: 100
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Angela lewis
Ranch Hand
Posts: 100
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
java.lang.NoSuchMethodError: javax.servlet.jsp.tagext.TagAttributeInfo.<init>(Ljava/lang/String;ZLjava/lang/String;ZZ)V
 
Jessica White
Ranch Hand
Posts: 30
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jessica White
Ranch Hand
Posts: 30
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Angela lewis
Ranch Hand
Posts: 100
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Angela lewis
Ranch Hand
Posts: 100
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Angela lewis
Ranch Hand
Posts: 100
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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;
 
Nitish Bahadur
Ranch Hand
Posts: 118
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Curiosity, what version of Tomcat are you running?
 
Colin Fletcher
Ranch Hand
Posts: 200
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You will need both jstl.jar and standard.jar and need Tomcat 5.x
 
Angela lewis
Ranch Hand
Posts: 100
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Angela lewis
Ranch Hand
Posts: 100
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Angela lewis
Ranch Hand
Posts: 100
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Angela lewis
Ranch Hand
Posts: 100
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Nitish Bahadur
Ranch Hand
Posts: 118
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is your JAVA_HOME set to? Can you please tell us the java version Tomcat is using?
 
Colin Fletcher
Ranch Hand
Posts: 200
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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....
 
Angela lewis
Ranch Hand
Posts: 100
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Mili
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
Ales Justin
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Dale Seng
Ranch Hand
Posts: 275
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic