如何將JSTL添加到Maven? - How to add JSTL to Maven? -开发者知识库

如何將JSTL添加到Maven? - How to add JSTL to Maven? -开发者知识库,第1张

I'm working on a JSF 2.0 project using Mojarra, PrimeFaces and Tomcat 6.x.

我正在使用Mojarra,PrimeFaces和Tomcat 6.x開發JSF 2.0項目。

I need to use c:forEach for some primefaces component like dynamic number of p:tab but i have problem with the c:forEach. All the other tag of JSTL work nice.

我需要使用c:forEach作為一些primefaces組件,如p:tab的動態數量,但我有c:forEach的問題。 JSTL的所有其他標簽都很好用。

I have the following error :

我有以下錯誤:

java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/LoopTagStatus

java.lang.NoClassDefFoundError:javax / servlet / jsp / jstl / core / LoopTagStatus

I use the following xmlns:c="http://java.sun.com/jsp/jstl/core", i tried to replace with xmlns:c="http://java.sun.com/jstl/core" but nothing display with the second.

我使用以下xmlns:c =“http://java.sun.com/jsp/jstl/core”,我試圖用xmlns替換:c =“http://java.sun.com/jstl/core”但第二個沒有任何顯示。

This is the exact version of lib:

這是lib的確切版本:

<dependency>
    <groupId>javax.faces</groupId>
    <artifactId>jsf-api</artifactId>
    <version>2.0.2-FCS</version>
    <scope>provided</scope>
</dependency>

<dependency>
    <groupId>com.sun.faces</groupId>
    <artifactId>jsf-impl</artifactId>
    <version>2.0.4-b03</version>
    <scope>provided</scope>
</dependency>

<dependency>
    <groupId>org.primefaces</groupId>
    <artifactId>primefaces</artifactId>
    <version>2.2.1</version>
</dependency>

<dependency>
    <groupId>javax.el</groupId>
    <artifactId>el-api</artifactId>
    <version>2.2</version>
</dependency>

<dependency>
    <groupId>org.glassfish.web</groupId>
    <artifactId>el-impl</artifactId>
    <version>2.2</version>
</dependency>

How i can fix it ?

我怎么解決它?

I can give more specific information if needed.

如果需要,我可以提供更具體的信息。

EDIT: I added and tried different scopes (runtime and compile) but nothing change:

編輯:我添加並嘗試了不同的范圍(運行時和編譯)但沒有改變:

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

The list of repository:

存儲庫列表:

  <repositories>
    <repository>
      <id>central</id>
      <name>Maven Repository Switchboard</name>
      <layout>default</layout>
      <url>http://repo1.maven.org/maven2</url>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </repository>
    <repository>
      <id>maven-repository.dev.java.net</id>
      <name>Java.net Repository for Maven 1</name>
      <url>http://download.java.net/maven/1/</url>
      <layout>default</layout>
    </repository>
    <repository>
      <id>maven2</id>
      <name>Java.net Repository for Maven</name>
      <url>http://download.java.net/maven/2</url>
      <layout>default</layout>
    </repository>
    <repository>
      <id>prime-repo</id>
      <name>Prime Technology Maven Repository</name>
      <url>http://repository.prime.com.tr</url>
      <layout>default</layout>
    </repository>
    <repository>
      <id>JBoss2</id>
      <url>https://repository.jboss.org/nexus/content/repositories/public</url>
    </repository>
    <repository>
      <id>JBoss</id>
      <url>http://repository.jboss.com/maven2</url>
    </repository>
    <repository>
      <id>EclipseLink Repo</id>
      <url>http://www.eclipse.org/downloads/download.php?r=1&amp;nf=1&amp;file=/rt/eclipselink/maven.repo</url>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
    <repository>
      <id>itextpdf.com</id>
      <name>Maven Repository for iText</name>
      <url>http://maven.itextpdf.com/</url>
    </repository>

    <repository>
      <id>guiceyfruit.release</id>
      <name>GuiceyFruit Release Repository</name>
      <url>http://guiceyfruit.googlecode.com/svn/repo/releases/</url>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <releases>
        <enabled>true</enabled>
      </releases>
    </repository>
  </repositories>

This is the content of $TOMCAT_HOME/lib

這是$ TOMCAT_HOME / lib的內容

annotations-api.jar catalina-ha.jar catalina-tribes.jar el-impl-2.2.jar jasper.jar jsf-api.jar
jsp-api.jar servlet-api.jar
tomcat-dbcp.jar
tomcat-i18n-fr.jar catalina-ant.jar
catalina.jar el-api-2.2.jar
jasper-el.jar jasper-jdt.jar
jsf-impl-2.0.4-b03.jar ojdbc6.jar
tomcat-coyote.jar tomcat-i18n-es.jar tomcat-i18n-ja.jar

annotations-api.jar catalina-ha.jar catalina-tribes.jar el-impl-2.2.jar jasper.jar jsf-api.jar jsp-api.jar servlet-api.jar tomcat-dbcp.jar tomcat-i18n-fr .jar catalina-ant.jar catalina.jar el-api-2.2.jar jasper-el.jar jasper-jdt.jar jsf-impl-2.0.4-b03.jar ojdbc6.jar tomcat-coyote.jar tomcat-i18n- es.jar tomcat-i18n-ja.jar

4 个解决方案

#1


55  

You must include the jstl library in your distribution. This may be provided by the container, although that is not recommended practice. The maven dependency for the current version (as of writing) is here:

您必須在分發中包含jstl庫。這可以由容器提供,但這不是推薦的做法。當前版本的maven依賴(寫作時)在這里:

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

Although, it's always worth checking the maven central repository for updates.

雖然,總是值得檢查maven中央存儲庫以獲取更新。

最佳答案:

本文经用户投稿或网站收集转载,如有侵权请联系本站。

发表评论

0条回复