IntelliJ and JSP/JSTL cannot resolve taglib for JSTL in tomcat7
If you are using maven, add following code in pom.xml inside the <dependencies></dependencies>
tag
<!-- https://mvnrepository.com/artifact/javax.servlet/jstl -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
First add this to the top of your .jsp
file:
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
It will still give syntax error but you can fix that by adding javax.servlet:jstl:1.2
as a module dependency. To do that, follow these steps:
- Click your project name and press F4 to bring up the module settings dialog.
- Then go to the
dependencies
tab in themodules
section. - Click the green
+
icon→
library→
From Maven. - Search for
javax.servlet:jstl:1.2
in the search bar and press OK and it will download and add the above mentioned library as a module. - Now you should not have any kind of syntax error.