0

I have been practicing JSTL tags in EclipseIDE but the code is throwing an HTTP Status 500 error.

I am trying to integrate JSTL tags into my .jsp files, but I am facing a TagLibraryValidator error. I am trying to just use the jstl tags in .jsp file and it is a basic program

<c:set var ="name" value="User"></c:set>
<c:out value="${name}"></c:out>

I have included <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> But it is giving HTTP Status 500-Intenal Server Error.

I have tried every possible solution available on the internet. These are all the solutions I have tried that were mentioned by various people on stackoverflow, youtube and other google Websites...

I have used jst-1.2 and pasted it in lib folder, jakarta.activation-2.0.0, jakarta.el-api-4.0.0, jakarta.servlet.jsp.jstl-2.0.0 and also 3.0.0, jakarta.servlet.jsp.jstl-api-2.0.0 ,jakarta.servlet.jsp-api-3.1.1, jakarta.servlet-api5.0.0, jakarta.xml.bind-api-3.0.0 I have tried to include them at various locations like mentioned by the online sources and tried various files etc.etc.

Of course not at a time but one after other but all gave **java.lang.NoClassDefFoundError: javax/servlet/jsp/tagext/TagLibraryValidator ** and some other errors like cannot invoke getAttributes() error.

Please help me with the proper version, inclusion of jar files.

P.S. I am using Eclipse IDE,Dynamic Wen Module 6.0, Apache Tomcat Server 10.1``

0

1 Answer 1

0

Tomcat 10.1 uses jakarta servlet packages at runtime, not javax, so tag libraries built for javax packages will not load. The simplest solution is to go back to Tomcat 9.

8
  • Thanks, that helped. But is there no solution if I want to run it on Tomcat 10.1? If there is, please help or provide the link of that solution. Thanks, again. Commented Dec 26, 2023 at 5:35
  • A newer version of the JSTL tag library will be compatible with Tomcat 10 and newer, however the JSP Editor and validation are not fully up to date for that changeover yet. Regardless, you should not be dropping your own jakarta.servlet.jsp and jakarta.servlet jars into the project--those are provided from the Tomcat runtime on the Java Build Path the same way that the Java standard class library comes from the Java runtime.
    – nitind
    Commented Dec 27, 2023 at 8:15
  • thanks for the advice @nitind. Switching to tomcat 9 helped. Could you also help me with forEach XML tags. All other tags are working but fotEach XML tag is throwing this exception. "An exception occurred processing [/xmlTags.jsp] at line [15]" Could you help me with this too? Commented Jan 1 at 17:48
  • If it's happening at runtime, it merits a separate question.
    – nitind
    Commented Jan 2 at 3:18
  • Yes, it is happening at runtime. Now, what should I do? All other tags like choose, when, import, parse are working but only forEach tag is throwing exception. It is not just my code, codes of people that worked while they are explaining in their videos(they are like 6 years old) are not working when I am using codes from their files that they provided Commented Jan 2 at 10:59

Not the answer you're looking for? Browse other questions tagged or ask your own question.