Results 1 to 11 of 11
Thread: Jstl
- 01-11-2010, 05:51 PM #1
Member
- Join Date
- Dec 2009
- Posts
- 13
- Rep Power
- 0
- 01-11-2010, 05:59 PM #2
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
You don't need any changes in the web.xml.
If your container doesn't have it already then add jstl.jar to your Web-Inf/lib. Otherwise don't add it at all.
- 01-11-2010, 06:32 PM #3
Senior Member
- Join Date
- Dec 2009
- Location
- Belgrade, Serbia
- Posts
- 364
- Rep Power
- 4
I guess there are few different approaches, here's mine:
1. create DIR called 'jstl' in your ../WEB-INF/lib/
and copy needed JSTL jars in it:
MyWebProject/WebContent/WEB-INF/lib/jstl/jstl.jar
MyWebProject/WebContent/WEB-INF/lib/jstl/standard.jar
2.To add this jars to classpath:
right click on your Dynamic Web Project 'MyWebProject' and choose
Properties => Java Build path => tab Libraries =>
button Add JARs => in Jar selection choose jars you just copied jstl.jar and standard.jar
(You will probably need to check
properties => Java EE Module Dependencies => JAR/module)
2. copy your *.tld files in
MyWebProject/WebContent/WEB-INF/tags/templates
3. each JSP page that will use JSTL should have this:
This way there is not need to add <taglib> in web.xmlJava Code:<%@ taglib uri="/WEB-INF/tags/templates/c.tld" prefix="c" %>
hope this will help,
please share you final solution to the rest of forum
good luck!
- 01-12-2010, 08:56 PM #4
Member
- Join Date
- Dec 2009
- Posts
- 13
- Rep Power
- 0
Still Problem
Hi
i tried out by your suggestion FON but its not working any alternative way??????? am using eclipse+tomcat 6+jdk1.5+jakarta-taglibs-standard-1.1.2
i have 2 webcontent folder one is under ROOT directory and another is mineproj/webcontent i tried out in both places but getting this error on tomcat console
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.NoClassDefFoundError: javax/servlet/jsp/tagext/TagLibraryValidatorLast edited by prakashkadakol; 01-12-2010 at 09:01 PM.
- 01-13-2010, 02:57 AM #5
Senior Member
- Join Date
- Dec 2009
- Location
- Belgrade, Serbia
- Posts
- 364
- Rep Power
- 4
Is everything OK with your servlet-api.jar versions?
Are you using same servlet-api.jar in Tomcat and in Eclipse during
writingt your code?
If it is, go to any of your servlets and place this code
and you should not have anyJava Code:javax.servlet.jsp.tagext.TagLibraryValidator t = new TagLibraryValidator() { };
java.lang.NoClassDefFoundError problems
- 01-13-2010, 03:26 AM #6
Member
- Join Date
- Dec 2009
- Posts
- 13
- Rep Power
- 0
mine servlet and jsp programmes are working fine under eclipse
i tried this code javax.servlet.jsp.tagext.TagLibraryValidator t = new TagLibraryValidator() {
};
in servlets but this throws an error java.lang.Error: Unresolved compilation problems:
javax.servlet.jsp.tagext cannot be resolved to a type
The type new TypeValidator(){} must implement the inherited abstract method TypeValidator.getActualValue(String, ValidationContext)
The type new TypeValidator(){} must implement the inherited abstract method TypeValidator.getAllowedFacets()
DB.Testamma.doGet(Testamma.java:25)
javax.servlet.http.HttpServlet.service(HttpServlet .java:617)
javax.servlet.http.HttpServlet.service(HttpServlet .java:717)
- 01-13-2010, 02:49 PM #7
Senior Member
- Join Date
- Dec 2009
- Location
- Belgrade, Serbia
- Posts
- 364
- Rep Power
- 4
Once again - it's servlet-api.jar problem!
If you use serlvet-api.jar from your Tomcat 6
it DOES NOT contain package : javax.servlet.jsp.tagext.
There are many other *.jars that has servlet in it's name
and contain package javax.servlet.jsp.tagext.
Go to
JAR Search - findJAR.com
type in search field name of package and class you need:
javax.servlet.jsp.tagext.TagLibraryValidator
and find one that will do your work (like servletapi-2.3.jar ).
I'm not very familiar with servlet specification (2.2, 2.3 ...3.0)
and how Tomcat implements it in his servlet-api.jar
looks like Tomcat 6.x implements servlet 2.5 spec and those
tags that you need are not part of it - they are extensions of some kind.
There is a catch - it can be tricky to use different servlet kinda jars
because Tomcat may cause problems so be patient,
this is not just
take another *.jar and place in on your classpath situation.
go tiger ! you can make this work !
- 01-13-2010, 04:25 PM #8
Member
- Join Date
- Dec 2009
- Posts
- 13
- Rep Power
- 0
st
HI
i added jervletapi.jar which u have mentioned now below code is in servlet
javax.servlet.jsp.tagext.TagLibraryValidator t = new TagLibraryValidator() {
};
but mine jsp code ie shown below even mine simple jsp pages also throws error i think now conflict between existing servletapi.jar and new added servlet-api2.3.jar
<%@ taglib uri="/WEB-INF/tags/templates/c.tld" prefix="c" %>
<html>
<head>
<title>Count to 10 Example (using JSTL)</title>
</head>
<body>
<c:forEach var="i" begin="1" end="10" step="1">
<c:out value="${i}" />
<br />
</c:forEach>
</body>
</html>
still throwing below error on console
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.NoSuchMethodError: javax.servlet.jsp.tagext.TagAttributeInfo.<init>(L java/lang/String;ZLjava/lang/String;ZZLjava/lang/String;ZZLjava/lang/String;Ljava/lang/String;)V
at org.apache.jasper.compiler.TagLibraryInfoImpl.crea teAttribute(TagLibraryInfoImpl.java:584)
at org.apache.jasper.compiler.TagLibraryInfoImpl.crea teTagInfo(TagLibraryInfoImpl.java:397)
at org.apache.jasper.compiler.TagLibraryInfoImpl.pars eTLD(TagLibraryInfoImpl.java:250)
at org.apache.jasper.compiler.TagLibraryInfoImpl.<ini t>(TagLibraryInfoImpl.java:163)
at org.apache.jasper.compiler.Parser.parseTaglibDirec tive(Parser.java:431)
at org.apache.jasper.compiler.Parser.parseDirective(P arser.java:494)
at org.apache.jasper.compiler.Parser.parseElements(Pa rser.java:1444)
at org.apache.jasper.compiler.Parser.parse(Parser.jav a:138)Last edited by prakashkadakol; 01-13-2010 at 04:49 PM.
- 01-13-2010, 05:38 PM #9
Senior Member
- Join Date
- Dec 2009
- Location
- Belgrade, Serbia
- Posts
- 364
- Rep Power
- 4
I got it ! :)
My Tomcat 6 in lib folder contains this jar:
C:\apache-tomcat-6.0.20\lib\jsp-api.jar
Inside of it is package:
javax.servlet.jsp.tagext
Maybe this jar must use some other jars that are in same lib folder
so check out your Tomcat!
Remove all new servlet jars that make a conflict,
and try with this
- 01-13-2010, 06:52 PM #10
Member
- Join Date
- Dec 2009
- Posts
- 13
- Rep Power
- 0
still a problem with JSTL
hi
i have made changes but nothing has been changed in error
- 01-13-2010, 07:17 PM #11
Senior Member
- Join Date
- Dec 2009
- Location
- Belgrade, Serbia
- Posts
- 364
- Rep Power
- 4
Have we or have we not resolve first error you posted:
"SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.NoClassDefFoundError: javax/servlet/jsp/tagext/TagLibraryValidator"
Now that we know that jsp-api.jar contains that class
this should be resolved?
After you answer question above
please post your exact error again so we can continue ;)
Similar Threads
-
List + JSTL
By initmax in forum Java ServletReplies: 8Last Post: 11-05-2009, 11:56 AM -
Why are we using JSTL in jsp?
By makpandian in forum JavaServer Pages (JSP) and JSTLReplies: 0Last Post: 06-30-2009, 10:15 PM -
jstl tag <if>
By subha in forum Advanced JavaReplies: 1Last Post: 04-02-2009, 09:07 PM -
jstl in jsp
By nagaprasanna in forum JavaServer Pages (JSP) and JSTLReplies: 0Last Post: 11-18-2008, 08:18 AM -
JSTL error
By Eric in forum JavaServer Pages (JSP) and JSTLReplies: 1Last Post: 06-11-2007, 09:36 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks