Question

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

This is relevant part from 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

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

    @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

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

Was it helpful?

Solution

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

either by using <tag/> or <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 -->

OTHER TIPS

You need </c:forEach> wrapping the content

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>

You forgot to end the

<c:forEach>

tag, close it with:

</c:forEach>

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top