0

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.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • Try to switch JSTL to 1.2 or 1.5 version and add the [following dependency](https://mvnrepository.com/artifact/org.glassfish.web/jakarta.servlet.jsp.jstl) in addition to jakarta.servlet.jsp.jstl-api. Use URL format to specify namespace in JSP file. – Egor Klepikov Jan 24 '23 at 07:09
  • I have already tried to use 1.2.2 JSTL version by adding the .JAR dependencies and specify it to pom.xml but nothing change. URI still not recognize... Maybe have you a link for a clean installation to try. Thank you for your answer. – Benjamin BASSET Jan 24 '23 at 07:36

1 Answers1

1

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

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555