开发者

JSTL in IntelliJ gives errors in JSP

开发者 https://www.devze.com 2023-03-31 18:10 出处:网络
I\'m playing with Google App Engine in IntelliJ. I\'m trying to use JSTL tags in my JSPs. I\'ve tried two different URIs I found on the internet, and both of them give me errors:

I'm playing with Google App Engine in IntelliJ. I'm trying to use JSTL tags in my JSPs. I've tried two different URIs I found on the internet, and both of them give me errors:

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

and

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

It reds out the URL and says it cannot resolve taglib. I've tried dropping different parts of the URL to see if Ctrl-Space gives me any autocomplete lo开发者_运维技巧ve, but no luck.

Any ideas what I need to do to make this work?


Make sure that JSTL library jars are added to the module dependencies.


Add something like this to your pom.xml under the <dependencies> node (you are using maven, right?):

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

For gradle and other build systems see https://mvnrepository.com/artifact/javax.servlet/servlet-api/2.5

Also, make sure you pick a suitable version for your project. To see all available versions check here.


In my case, I had to download the .jar from apache (https://tomcat.apache.org/taglibs/standard/) and add to my project dependencies.

File > Project Structure > Modules > Dependencies


I resolved it by adding jstl-1.2 in the libraries.

  • Right-click on "project"
  • Then go into "open modules setting"
  • Then in "libraries" click on the "+", then "add with maven"
  • Click on the checkbox to download in a folder, change the folder path for .../WEB-INF/lib (create the lib folder)

    JSTL in IntelliJ gives errors in JSP

0

精彩评论

暂无评论...
验证码 换一张
取 消