Search code examples
jakarta-eejstl

How add JSTL to my Jakarta EE 10 project running GlassFish


First, sorry for my poor english.

I begin to learn jakarta EE and I discover Jakarta Standard Tag Library (JSTL) for prevent XSS attack.

The IDE say this : "cannot resolve taglib uri" I don't find any guide for a way to use JSTL in intelliJ with maven, glassfish 7 and recent Jakarta EE 10.

I tried to add JSTL in my Jakarta EE project in IntelliJ ultimate. My project run with glassfish 7.0 server and JDK 19. I tried to download JSTL lib by adding a library from maven in the project structure setting. I saw a lot of problem with intelliJ and JSTL 3.0 so I tried many version of JSTL, 3.0, 1.5 and 1.2.

I tried to declare URI by two syntax in the bottom of my JSP :

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

I added dependecies in pom.xml like this :

<dependency>
    <groupId>jakarta.platform</groupId>
    <artifactId>jakarta.jakartaee-api</artifactId>
    <version>10.0.0</version>
    <scope>provided</scope>
</dependency>

<dependency>
    <groupId>jakarta.servlet.jsp.jstl</groupId>
    <artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
    <version>3.0.0</version>
</dependency>

Can someone help me ? That's my first question, i am a noobie so please be indulgent if my question is stupid ^^ thanks.


Solution

  • I tried to add JSTL in my Jakarta EE project in IntelliJ ultimate. My project run with GlassFish 7.0 server and JDK 19

    Stop

    Normal Jakarta EE servers such as GlassFish already ship with JSTL out the box. You do not need to manually install it like as you would need to do for barebones servletcontainers such as Tomcat.

    Please completely remove the individual JSTL dependency from your pom.xml. Duplicate classes in runtime classpath would only cause runtime conflicts.

    See also:


    The IDE say this : "cannot resolve taglib uri"

    Ignore and run it. Does it work? Then it's very definitely a false error. The IDE version being used just needs to catch up with the current state of technology. Upgrade it. Does it still whine? Report it to the IDE guys. In case of IntelliJ IDEA it's here: https://youtrack.jetbrains.com/issues/IDEA