通过查看JSP, Servlets and JDBC for Beginners: Build a Database App
上由Chad Darby
完成的教程系列Intellij IDEA
并在Udemy的帮助下,我在<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%--To use JSTL core tags we need to import the following URL with prefix--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
</head>
<%
// need to define a sample array
String cities[]={"City1","City2","City3","City4"};
// to use JSTL tags they have a to be a part of an attribute, either in the scope of the pageContext, session or application
pageContext.setAttribute("myCities",cities);
%>
<body>
<%-- for printing them in for each loop--%>
<c:forEach var="cityName" items="${myCities}" >
<%-- here we are using JSP expression language as ${...}}--%>
${cityName} <br/>
</c:forEach>
</body>
</html>
中编写了以下代码
JSTL
并按照本教程作者(注意:教程已在WEB-INF/lib
完成)和Eclipse IDE
回答的建议,在BalusC
下添加IDEA
个库。代码工作正常,但IDEA
编辑给我
无法使用uri BalusC answer
解析taglib
和
无法解析符号&#39; c:forEach&#39;
并且这些线条呈红色,如图http://java.sun.com/jsp/jstl/core
所示为什么会这样?在tableView.scrollToColumn(anyColumn);
中是否还有其他地方可以添加这些库?提前致谢
答案 0 :(得分:0)
在使用基于Spring的项目时,我收到了类似的消息。我通过在pom.xml
中添加以下依赖项来解决它 <dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.servlet/jstl -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
下一个打开终端,然后做maven clean install
mvn -U clean install