java <JSP>陷入错误:“未终止的 <c:forEach 标签”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17332921/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-01 01:42:10  来源:igfitidea点击:

<JSP>Stuck in the error : "Unterminated &lt;c:forEach tag "

javajspibatis

提问by user2470075

I am working on JSP and stuck in this error "Unterminated <c:forEach tag "

我正在处理 JSP 并陷入这个错误“未终止 <c:forEach 标记”

This is relevant part from contentStatis.jsp

这是 contentStatis.jsp 的相关部分

<tbody>

            <br><c:forEach var="contentStatis" items="${resultcount}" >
                <td align="center"><c:out value="${contentStatis.dtm}" /></td>
                <td align="center"><c:out value="${contentStatis.StudentPkg}" /></td>
                <td align="center"><c:out value="${contentStatis.Shared}" /></td>
                <td align="center"><c:out value="${contentStatis.NonShared}" /></td>                

            </tbody>

This is the relevant part from Controller.java

这是 Controller.java 的相关部分

List<ContentStatis> result = ContentStatisRepository.statis(maps);
List<ContentStatis> resultcount = ContentStatisRepository.mnote(maps);
Pagination<ContentStatis> resultList = PaginationUtil.getPaginationList(result, condition, (long)result.size(), Order.DESC);

model.addAttribute("result", result);
model.addAttribute("condition", condition);
model.addAttribute("resultList", resultList);
model.addAttribute("resultcount", resultcount);         
    }
    return "admin/statisMng/contentStatis";

And this is relevant part from the Repository.java

这是来自 Repository.java 的相关部分

    @Statement(id="ContentStatis.mnote")
public List<ContentStatis> mnote(Map<String, Object> maps);

Does anyone see where the problem is? When I execute the jsp, the error occurs

有没有人看到问题出在哪里?当我执行jsp时,出现错误

"/WEB-INF/views/admin/statisMng/contentStatis.jsp(459,0) Unterminated <c:forEach tag"

“/WEB-INF/views/admin/statisMng/contentStatis.jsp(459,0) 未终止的 <c:forEach 标签”

回答by BevynQ

most jstl tags are block tags so they need to be terminated

大多数jstl标签是块标签,所以它们需要被终止

either by using <tag/>or <tag></tag>

通过使用<tag/><tag></tag>

<c:forEach var="contentStatis" items="${resultcount}" >
    <td align="center"><c:out value="${contentStatis.dtm}" /></td>
    <td align="center"><c:out value="${contentStatis.StudentPkg}" /></td>
    <td align="center"><c:out value="${contentStatis.Shared}" /></td>
    <td align="center"><c:out value="${contentStatis.NonShared}" /></td>   
</c:forEach>  <!-- you are missing this bit -->

回答by Jigar Joshi

You need </c:forEach>wrapping the content

您需要</c:forEach>包装内容

回答by Bert Lamb

I'm pretty sure your error is telling you exactly what the problem is. This tag isn't terminated

我很确定您的错误确切地告诉您问题是什么。此标签未终止

<c:forEach var="contentStatis" items="${resultcount}" >

Somewhere you need to add a

你需要在某处添加一个

</c:forEach>

回答by Ricardo

You forgot to end the

你忘了结束

<c:forEach>

tag, close it with:

标签,关闭它:

</c:forEach>

回答by mel3kings

It's self explanatory:

这是不言自明的:

"/WEB-INF/views/admin/statisMng/contentStatis.jsp(459,0) Unterminated <c:forEach tag"

means you need to close the tag. or "terminate" it.

意味着您需要关闭标签。或“终止”它。