java无法在Intellij IDEA中解析uri为的taglib
通过查看由Chad Darby
完成的Udemy系列教程JSP, Servlets and JDBC for Beginners: Build a Database App
,并在BalusC answer的帮助下,我在Intellij IDEA
中编写了以下代码
<%@ 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>
并根据本教程作者和BalusC
答案的建议,在WEB-INF/lib
下添加JSTL
libs。代码运行良好,但是IDEA
编辑器给我
cannot resolve taglib with uri http://java.sun.com/jsp/jstl/core
及
cannot resolve symbol 'c:forEach'
为什么会这样?。在IDEA
中还有其他地方可以添加这些库吗?提前谢谢
共 (0) 个答案