【问题标题】:How do I include a JSTL 1.2 implementation through Maven?如何通过 Maven 包含 JSTL 1.2 实现?
【发布时间】:2011-07-29 13:28:00
【问题描述】:

我在尝试使用 JSTL 时遇到了一个奇怪的 maven 错误:

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>jstl</artifactId>
    <version>1.2</version>
</dependency>

我认为这是因为它不是一个具体的实现。 Glassfish 中似乎有一个具体的实现,但我不知道如何包含它。

我得到的错误是这样的:

java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/servlet/jsp/jstl/core/LoopTagSupport

java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/servlet/jsp/jstl/core/ConditionalTagSupport

【问题讨论】:

标签: maven jstl


【解决方案1】:

如果您使用的应用程序服务器已经提供了 JSTL 实现,则将 &lt;scope&gt;provided&lt;/scope&gt; 添加到您的定义中就足够了,否则您可以尝试添加

<dependency> <groupId>org.glassfish.web</groupId> <artifactId>jstl-impl</artifactId> <version>1.2</version> </dependency>

【讨论】:

  • 好吧,maven 对此很满意。感谢你的回答。 Tomcat 拒绝了 :(
  • 您尝试了哪种选择?第二个实际上是否在您的应用程序中包含了 jstl-impl jar?如果 Tomcat 对第一个不满意,我猜它没有提供 jstl 实现。你能发布任何看起来相关的错误消息吗?
猜你喜欢
  • 2022-06-28
  • 2018-01-13
  • 2014-06-30
  • 2018-06-08
  • 1970-01-01
  • 2015-05-11
  • 2019-04-10
  • 2012-07-06
  • 1970-01-01
相关资源
最近更新 更多