What JAR files are needed for Eclipse to use JSTL so it ultimately works on GAE/J?

后端 未结 6 1589
误落风尘
误落风尘 2021-02-04 07:43

I\'ve been trying for longer than I\'d like to admit to get JSTL working under Eclipse (and ultimately under GAE/J). I\'ve downloaded Eclipse, the Google App Engine Extension f

相关标签:
6条回答
  • 2021-02-04 08:15

    Add taglibs-standard-impl-1.2.5 from Apache to the build path of the project. This may resolve the issue.

    0 讨论(0)
  • 2021-02-04 08:16

    Ensure that your web.xml root declaration complies at least Servlet 2.4.

    <web-app
        xmlns="http://java.sun.com/xml/ns/j2ee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
        version="2.4">
    
        <!-- Config here. -->
    
    </web-app>
    

    Or if your servletcontainer supports it, prefer 2.5:

    <web-app 
        xmlns="http://java.sun.com/xml/ns/javaee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
        version="2.5">
    
        <!-- Config here. -->
    
    </web-app>
    

    O if it supports the latest version3.0

    <web-app 
        xmlns="http://java.sun.com/xml/ns/javaee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
        version="3.0">
    
        <!-- Config here. -->
    
    </web-app>
    

    Otherwise everything will fall back to least supported modus and taglibs may break like that.

    Also ensure that you don't have loose tld files wandering around in the classpath (the /WEB-INF/lib folder, among others), they will collide with the ones in JAR files. Oh, also ensure that you didn't manually define the tlds in web.xml, keep it clean.

    0 讨论(0)
  • 2021-02-04 08:23

    As far as i know you need jstl.jar and standard.jar. Put those under WEB-INF/lib.

    0 讨论(0)
  • 2021-02-04 08:28

    You only need to specify this dependency in your Maven POM:

    <dependency>
        <groupId>jstl</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>
    

    In my code, this provided everything I needed for the following JSP taglib to work:

    <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    
    0 讨论(0)
  • 2021-02-04 08:36

    I had the same issue and I simply put the prefix = "c" at the end of the taglib definition

    before:

    <%@ taglib  prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    

    after:

    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    

    And all warnings disappear from Eclipse.

    0 讨论(0)
  • 2021-02-04 08:38

    add jstl-1.2-sources.jar into your Tomcat\lib directory

    0 讨论(0)
提交回复
热议问题