【发布时间】:2014-05-30 05:07:54
【问题描述】:
我在控制器中有列表
List l=serviceClientServiceImpl.getSavedParents(clientId);
uiModel.addAttribute("savedParents",l);
List<Parent> parentList =
(List<Parent>) serviceClientServiceImpl.getParents("Parent",Long.valueOf(clientId));
uiModel.addAttribute("parentList", parentList);
我正在 jsp 中检索它,如下所示
<ul style="max-width: 300px;" class="nav nav-pills nav-stacked" id="menuId">
<c:forEach items="${parentList}" var="test">
<li ><a href="#" value="${test.id}-${test.category}" id="${parent.id}" onclick="return getQuestions(this);" >
<input type="checkbox" value="${test.id}">${test.name }</a></li>
</c:forEach>
</ul>
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
<c:forEach items="${savedParents}" var="test1">
<ul style="max-width: 300px;" class="nav nav-pills nav-stacked">
<li class="active"><a href="#" value="${test1.id}" onclick="return getQuestions(this);">
<input type="checkbox" value="${test1.id}"></a></li>
</ul>
</c:forEach>
现在我想合并两者和哪里 test.id 等于 test1.id 然后我想添加一个 html class="active"
我尝试了以下方式
<ul style="max-width: 300px;" class="nav nav-pills nav-stacked" id="menuId">
<c:forEach items="${parentList}" var="test">
<c:forEach items="${savedParents}" var="test1">
<c:when test3="${test.id}==${test1.id }">
<li ><a href="#" class="active" value="${test.id}-${test.category}" id="${parent.id}" onclick="return getQuestions(this);" >
<input type="checkbox" value="${test.id}">${test.name }</a></li>
</c:when>
<c:otherwise>
<li ><a href="#" value="${test.id}-${test.category}" id="${parent.id}" onclick="return getQuestions(this);" >
<input type="checkbox" value="${test.id}">${test.name }</a></li>
</c:otherwise>
</c:forEach>
<%-- <li ><a href="#" value="${test.id}-${test.category}" id="${parent.id}" onclick="return getQuestions(this);" >
<input type="checkbox" value="${test.id}">${test.name }</a></li> --%>
</c:forEach>
</ul>
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
但我在 eclipse 中遇到错误
Multiple annotations found at this line:
- Missing required attribute
"test"
- Undefined attribute name
"test3"
- Missing required attribute
"test"
- Undefined attribute name
"test3"
任何机构都可以帮助我吗?
【问题讨论】: