添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams There is a subtlety between version 1.1.2, version 1.2, Tomcat and GlassFish. See here for details: tshikatshikaaa.blogspot.nl/2012/07/… Jérôme Verstrynge Jul 27, 2012 at 17:55

The dependencies mentioned above is not enough for me(using Tomcat 5.x as servlet container, which doesn't provide JSTL implementation itself). It just imports the according JSTL interface package into project, and will cause a runtime error in Tomcat.

Here is the dependency part used in my project, hopefully can help others out. The hardest part is the naming of the Apache's JSTL implementation in repository.

  <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.1.1</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>taglibs</groupId>
        <artifactId>standard</artifactId>
        <scope>runtime</scope>
        <version>1.1.1</version>
    </dependency>
    <dependency>
        <groupId>taglibs</groupId>
        <artifactId>c</artifactId>
        <version>1.1.1</version>
        <scope>runtime</scope>
        <type>tld</type>
    </dependency>
    <dependency>
        <groupId>taglibs</groupId>
        <artifactId>fmt</artifactId>
        <version>1.1.1</version>
        <scope>runtime</scope>
        <type>tld</type>
    </dependency>
                @dcompiled I don't find official document on this from Maven, but for my guess, tld stands for "Tag Library Descriptor", which itself is XML file.
– Jerry Tian
                Feb 4, 2012 at 7:00
                for the record, I'm using tomcat 7 and the one given in the accepted answer seems to be enough for me...
– eis
                Aug 22, 2012 at 12:30

You need to add it to your pom.xml file.

In the dependencies node you need to add a reference to JSTL. You will probably need to set its scope to compile. So it would look something like this

<dependency>
  <groupId>javax.servlet</groupId>
  <artifactId>jstl</artifactId>
  <version>"whatever version you need"</version>
  <scope>runtime</scope>
</dependency>

This is assuming you have the proper references to the maven distribution repository in your pom.xml or settings.xml

Does this include the standard.jar too? I am using GlassFish, should including just the jstl dependency work? – Sajib Acharya Feb 10, 2016 at 18:41 standard.jar is for JSTL 1.0. You should absolutely not include it along JSTL 1.1 or newer. If you do so, then EL might stop working because it was originally part of JSTL 1.0 and later moved into JSP 2.0. – BalusC Apr 2, 2020 at 9:02 <dependency> <groupId>org.apache.taglibs</groupId> <artifactId>taglibs-standard-spec</artifactId> <version>1.2.1</version> </dependency> <dependency> <groupId>org.apache.taglibs</groupId> <artifactId>taglibs-standard-impl</artifactId> <version>1.2.1</version> </dependency> <!-- From taglib doc: To use this distribution with your own web applications, add the following JAR files to the '/WEB-INF/lib' directory of your application: - taglibs-standard-spec-1.2.1.jar - taglibs-standard-impl-1.2.1.jar - taglibs-standard-jstlel-1.2.1.jar - xalan-2.7.1.jar - serializer-2.7.1.jar <dependency> <groupId>xalan</groupId> <artifactId>xalan</artifactId> <version>2.7.1</version> </dependency> <dependency> <groupId>xalan</groupId> <artifactId>serializer</artifactId> <version>2.7.1</version> </dependency> <!-- TAGLIB: -->

I had the same problem. I solved it by adding Apache Tomcat libraries to the Java build path.

See my screenshots, I am using Maven:

Before adding Tomcat libraries:

After adding Tomcat libraries:

It seems in the last few weeks or so the Maven JSTL dependency has vanished from at least the central repository. This has caused a number of issues around the web.

Oracle has released the separate API and implementation dependencies which is really how they should be broken down. Now, instead of having one javax.servlet.jstl dependency you will use the following:

<dependency>
    <groupId>javax.servlet.jsp.jstl</groupId>
    <artifactId>jstl-api</artifactId>
    <version>1.2</version>
</dependency>
<dependency>
    <groupId>org.glassfish.web</groupId>
    <artifactId>jstl-impl</artifactId>
    <version>1.2</version>
</dependency>

And this works.

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.