Java JSTL ForEachTag不包含名为setVar的方法
情况: 做一个简单的练习,从二维数组中读取国家 目标: 在JSP文件中循环字符串[],并打印其内容 问题:Java JSTL ForEachTag不包含名为setVar的方法,java,jsp,foreach,jstl,Java,Jsp,Foreach,Jstl,情况: 做一个简单的练习,从二维数组中读取国家 目标: 在JSP文件中循环字符串[],并打印其内容 问题: Type org.apache.taglibs.standard.tag.rt.core.ForEachTag contains no methods named setVar. <c:forEach items="${array}" var="country"> ^-------^ <%@
Type org.apache.taglibs.standard.tag.rt.core.ForEachTag contains no methods named setVar.
<c:forEach items="${array}" var="country">
^-------^
<%@ page import="service.CountryFinderSoapBindingStub"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ page import="java.net.URL" %>
<%@ page import="java.util.ArrayList" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<%
CountryFinderSoapBindingStub c = new CountryFinderSoapBindingStub(new URL("http://localhost:7001/World_Countries/services/CountryFinder"),null);
String[][] array = c.findAllCountries();
%>
The Countries are:
<br>
<c:forEach items="${array}" var="country">
<p>City: <c:out value="${array[country][0]}"></c:out></p> <br>
<p>Country: <c:out value="${array[country][1]}"></c:out></p>
</c:forEach>
</body>
</html>
Type org.apache.taglibs.standard.tag.rt.core.ForEachTag不包含名为setVar的方法。
^-------^
测试:
我在Stackoverflow和around the net中看到了一些示例,它们都有相同的语法。不知道发生了什么事
代码:
Type org.apache.taglibs.standard.tag.rt.core.ForEachTag contains no methods named setVar.
<c:forEach items="${array}" var="country">
^-------^
<%@ page import="service.CountryFinderSoapBindingStub"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ page import="java.net.URL" %>
<%@ page import="java.util.ArrayList" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<%
CountryFinderSoapBindingStub c = new CountryFinderSoapBindingStub(new URL("http://localhost:7001/World_Countries/services/CountryFinder"),null);
String[][] array = c.findAllCountries();
%>
The Countries are:
<br>
<c:forEach items="${array}" var="country">
<p>City: <c:out value="${array[country][0]}"></c:out></p> <br>
<p>Country: <c:out value="${array[country][1]}"></c:out></p>
</c:forEach>
</body>
</html>
在此处插入标题
这些国家是:
城市:
国家:
已解决。将jstl-1.2.jar更改为另一个更重的文件(405KB)。我好像下载了一些旧的东西