解決在jsp上將EL表示式的值賦予變數
阿新 • • 發佈:2019-01-07
<c:forEach var="qListBySubject" items="${sessionScope.qListBySubject }">
<tr>
<%=i++ %>. ${qListBySubject.questionName} ---${qListBySubject.questionId}
<table>
<tr>
<c:set var="v" value="${qListBySubject.questionId}" scope="request"/>
<%
id = (Integer)request.getAttribute("v");
System.out.println(request.getAttribute("v")+"******************");
List<Option> optionListByQuestion = optionService.getOptionByQuestion(id);
for(int j =0 ; j< optionListByQuestion.size();j++){
Option c = optionListByQuestion.get(j);
%>
<td><input type="checkbox" value="<%=c.getOptionId() %>" /></td>
<td><%=c.getOptionName() %></td>
<%
}
%>
</tr>
</table>
</tr>
</c:forEach>
<tr>
<%=i++ %>. ${qListBySubject.questionName} ---${qListBySubject.questionId}
<table>
<tr>
<c:set var="v" value="${qListBySubject.questionId}" scope="request"/>
<%
id = (Integer)request.getAttribute("v");
System.out.println(request.getAttribute("v")+"******************");
List<Option> optionListByQuestion = optionService.getOptionByQuestion(id);
for(int j =0 ; j< optionListByQuestion.size();j++){
Option c = optionListByQuestion.get(j);
%>
<td><input type="checkbox" value="<%=c.getOptionId() %>" /></td>
<td><%=c.getOptionName() %></td>
<%
}
%>
</tr>
</table>
</tr>
</c:forEach>