Java ForEach不适用于列表

Java ForEach不适用于列表,java,jsp,spring-mvc,jstl,Java,Jsp,Spring Mvc,Jstl,使用JSTL和Spring时出现问题……这不允许我重复我的列表 这是我的看法 <html> <body> // This prints fine <h2>${profileList}</h2> // this doesn't <c:forEach var="x" items="${profileList}" > <c:out value="${x}"/>

使用JSTL和Spring时出现问题……这不允许我重复我的列表

这是我的看法

<html>
<body>

    // This prints fine
    <h2>${profileList}</h2>


    // this doesn't
    <c:forEach var="x" items="${profileList}" >
        <c:out value="${x}"/>
        <br />
    </c:forEach>
</body>
</html>
下面是构建列表的代码

public List<String> getProfiles() throws Exception {
        List profileList = new ArrayList<String>();

        Profiles profiles = analytics.management().profiles().list("~all", "~all").execute();

        for (Profile profile : profiles.getItems()) {
            profileList.add(profile.getId());
        }

        return profileList;
    }
public List getProfiles()引发异常{
List profileList=new ArrayList();
Profiles Profiles=analytics.management().Profiles().list(“~all”、“~all”).execute();
对于(配置文件:profiles.getItems()){
profileList.add(profile.getId());
}
返回配置文件列表;
}

您需要在使用JSTL之前声明它。将以下内容添加到JSP的顶部:

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

您需要在使用JSTL之前声明它。将以下内容添加到JSP的顶部:

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