JSP / JSTL - 为什么我收到错误“结束标记”< / c:forEach“是不平衡的”?

时间:2015-05-08 15:02:36

标签: jsp servlets jstl

“HTTP Status 500 - /process.jsp(line:42,column:10)结束标记”< / c:forEach“是不平衡的”是我得到的错误。

我正在循环遍历从servlet传递的对象列表。这些对象有一个我从内部循环的formProperties列表。

我的.jsp:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<link href="jquery/jquery-ui.css" rel="stylesheet" type="text/css">
<link href="css/style.css" rel="stylesheet" type="text/css">
<title>Process</title>
</head>
<body>
    <a class="topButton" href="GetProcesses">BACK</a>
    <div id="wrapper">
        <div id="tabs">
            <ul id="tabList">
                <c:if test="${pastTasksList.size() > 0}">
                    <c:forEach items="${pastTasksList}" var="pastTask">
                        <li><a href="#${fn:replace(pastTask.getName(), ' ', '')}">${pastTask.getName()}</a></li>
                    </c:forEach>
                </c:if>
                <c:forEach items="${taskList}" var="task">
                    <li><a href="#${fn:replace(task.getName(), ' ', '')}">${task.getName()}</a></li>
                </c:forEach>
            </ul>
            <c:if test="${pastTasksList.size() > 0}">
                <c:forEach items="${pastTasksList}" var="pastTask">
                    <div id="${fn:replace(pastTask.getName(), ' ', '')">
                        <h3>Previous Details: </h3>
                        <table id="historyTable">
                            <c:forEach items="${pastTask.getFormProperties()}" var="property">
                                <c:if test="${!fn:contains(property.getName(), 'task')}">
                                    <tr>
                                        <th>${property.getName()}</th>
                                        <td>${property.getVariable()}</td>
                                    </tr>
                                </c:if>
                            </c:forEach>
                        </table>
                    </div>
                </c:forEach>
            </c:if>
            <form action="CompleteTask" method="post" name="taskForm" id="taskForm">
            <c:forEach items="${formPropertiesList}" var="formProperties" varStatus="status">
                <div id="${fn:replace(taskList[status.index].getName(), ' ', '')}">
                    <h3>${taskList[status.index].getDescription()}</h3>
                    <c:forEach items="${formProperties}" var="property">
                        <div id="${property.getId()}Title">${property.getName()}:</div>
                        <br />
                        <c:set var="type" value="${property.getType().getName()}" />
                        <c:if test="${type == 'string'}">
                            <c:if test="${property.isRequired() == 'true' }">
                                <input type="text" id="${property.getId()}" name="${property.getId()}" value="${property.getValue()}" required /><br />
                            </c:if>
                            <c:if test="${property.isRequired() == 'false' }">
                                <input type="text" id="${property.getId()}" name="${property.getId()}" value="" /><br />
                            </c:if>
                        </c:if>
                        <c:if test="${type == 'long'}">
                            <c:if test="${property.isRequired() == 'true' }">
                                <input type="text" id="${property.getId()}" name="${property.getId()}" value="${property.getValue()}" required /><br />
                            </c:if>
                            <c:if test="${property.isRequired() == 'false' }">
                                <input type="text" id="${property.getId()}" name="${property.getId()}" value="" /><br />
                            </c:if>
                        </c:if>
                        <c:if test="${type == 'date'}">
                            <c:if test="${property.isRequired() == 'true' }">
                                <input type="date" id="${property.getId()}" name="${property.getId()}" value="" required /><br />
                            </c:if>
                            <c:if test="${property.isRequired() == 'false' }">
                                <input type="date" id="${property.getId()}" name="${property.getId()}" value="" /><br />
                            </c:if>
                        </c:if>
                        <c:if test="${type == 'enum'}">
                            <select id="${property.getId()}" name="${property.getId()}">
                                <c:forEach var="entry" items='${property.getType().getInformation("values")}'>
                                    <option value="${entry.key}">${entry.value}</option>
                                </c:forEach>
                            </select><br /><br />
                        </c:if>
                        <c:if test="${type == 'product'}">
                            <div id="${type}">
                                <ul>
                                    <li>
                                        <h4>Product:</h4>
                                        <div id="products" class="lookup">
                                            <input class="checkBoxes" type="checkbox" name="product" value="anaesthetic"> Anaesthetic<br />
                                            <input class="checkBoxes" type="checkbox" name="product" value="analgesic"> Analgesic<br />
                                            <input class="checkBoxes" type="checkbox" name="product" value="antacid"> Antacid<br />
                                        </div>
                                    </li>
                                    <li>
                                        <h4>Process:</h4>
                                        <div id="processes" class="lookup">
                                        </div>
                                    </li>
                                    <li>
                                        <h4>Equipment:</h4>
                                        <div id="equipment" class="lookup">
                                        </div>
                                    </li>
                                </ul>
                            </div><br /><br />
                        </c:if>
                    </c:forEach>
                    <input type="hidden" name="task${status.index}" value="${taskList[status.index].getId()}" /><br />
                </div>
            </c:forEach>
            </form>
        </div>
        <input id="submit" form="taskForm" type="submit" value="Complete Task" />
    </div>

我附上了所有代码,因为我不知道问题可能来自哪里。

0 个答案:

没有答案