简体   繁体   English

如何将 JSTL 添加到我运行 GlassFish 的 IntelliJ Jakarta EE 10 项目

[英]How add JSTL to my IntelliJ 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.我开始学习 Jakarta EE,并发现了用于防止 XSS 攻击的 Jakarta 标准标签库 (JSTL)。

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. IDE 是这样说的:“无法解析 taglib uri” 我没有找到任何有关在 maven、glassfish 7 和最近的 Jakarta EE 10 的 intelliJ 中使用 JSTL 的指南。

I tried to add JSTL in my Jakarta EE project in IntelliJ ultimate.我尝试在 IntelliJ Ultimate 的 Jakarta EE 项目中添加 JSTL。 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.我的项目使用 glassfish 7.0 服务器和 JDK 19 运行。我尝试通过在项目结构设置中添加来自 maven 的库来下载 JSTL 库。 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.我看到了很多关于 intelliJ 和 JSTL 3.0 的问题,所以我尝试了很多版本的 JSTL,3.0、1.5 和 1.2。

I tried to declare URI by two syntax in the bottom of my JSP:我试图在我的 JSP 的底部通过两种语法声明 URI:

`<%@ 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:我在 pom.xml 中添加了依赖项,如下所示:

<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.这是我的第一个问题,我是菜鸟,所以如果我的问题很愚蠢,请放纵^^谢谢。

I tried to add JSTL in my Jakarta EE project in IntelliJ ultimate.我尝试在 IntelliJ Ultimate 的 Jakarta EE 项目中添加 JSTL。 My project run with GlassFish 7.0 server and JDK 19我的项目使用GlassFish 7.0 服务器和 JDK 19 运行

Stop停止

Normal Jakarta EE servers such as GlassFish already ship with JSTL out the box.普通的 Jakarta EE 服务器,例如 GlassFish,已经随附了 JSTL。 You do not need to manually install it like as you would need to do for barebones servletcontainers such as Tomcat.不需要像安装 Tomcat 等准系统 servletcontainer 那样手动安装它。

Please completely remove the individual JSTL dependency from your pom.xml .请从您的pom.xml中完全删除单个 JSTL 依赖项。 Duplicate classes in runtime classpath would only cause runtime conflicts.运行时类路径中的重复类只会导致运行时冲突。

See also:也可以看看:


The IDE say this: "cannot resolve taglib uri" IDE 是这样说的:“无法解析 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.正在使用的IDE版本只需要赶上现在的state的技术即可。 Upgrade it.升级它。 Does it still whine?它还在发牢骚吗? Report it to the IDE guys.报告给 IDE 的家伙。 In case of IntelliJ IDEA it's here: https://youtrack.jetbrains.com/issues/IDEA如果是 IntelliJ IDEA,它在这里: https://youtrack.jetbrains.com/issues/IDEA

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM