You forgot ${}
in value attribute of <c:set
change this line:
<c:set var="teacherId" scope="session" value="teacherView"></c:set>
to
<c:set var="teacherId" scope="session" value="${teacherView}"/>
質問
I have a list object in that I m retriving details of perticular id. so i have code like this,
<c:forEach var="teacherView" items="${teacherInfoById}">
<c:if test="${teacherView.getTeacherId()==param.teacherId}">
<c:out value="${teacherView.getTeacherId()}" />
<c:set var="teacherId" scope="session" value="teacherView"></c:set>
</c:if>
</c:forEach>
it is working fine but in next line I am getting error,
id:<c:out value="${teacherId.getTeacherId()}"></c:out>
I think the variable cant access outside the foreach can any one help in this.
解決
You forgot ${}
in value attribute of <c:set
change this line:
<c:set var="teacherId" scope="session" value="teacherView"></c:set>
to
<c:set var="teacherId" scope="session" value="${teacherView}"/>