简体   繁体   English

Eclipse JSTL核心自动完成

[英]Eclipse JSTL Core Autocomplete

Eclipse's auto-complete for JSP tags works with Spring Security tags, but not JSTL core. Eclipse的JSP标记自动完成适用于Spring Security标记,但不适用于JSTL核心。

I've got the following declarations at the top of the JSP file: 我在JSP文件的顶部有以下声明:

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>

I'm depending on JSTL: 我依赖于JSTL:

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

...But curiously, JSTL Core never auto-suggests. ......但奇怪的是,JSTL Core永远不会自动暗示。

The problem is that the jstl-api.jar that likely comes with the javax.servlet>jstl depencency does not contain the TLD files in the META-INF . 问题是jstl-api.jar可能带有javax.servlet>jstl depencency,它不包含META-INFTLD文件。 What you need is the jstl-impl.jar file to be available somewhere on the project classpath (Maven dependencies or just included directly) because in the jstl-impl.jar file you can see it has this file: META-INF/c.tld 你需要的是jstl-impl.jar文件,可以在项目类路径的某个地方使用(Maven依赖项或直接包含),因为在jstl-impl.jar文件中你可以看到它有这个文件: META-INF/c.tld

If the Eclipse JSP editor can read the jstl-impl.jar from your project classpath, then it can read in the tag info and give you auto-complete. 如果Eclipse JSP编辑器可以从项目类路径中读取jstl-impl.jar ,那么它可以读取标记信息并为您提供自动完成功能。

Eclipse JSP编辑器中jstl完成的屏幕截图

If you are using Jboss or other servers try jstl-api.jar. 如果您使用的是Jboss或其他服务器,请尝试使用jstl-api.jar。 Add it to the eclipse classpath and it should work like charm. 将它添加到eclipse类路径中,它应该像魅力一样工作。

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

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