I have a JSP file and in that file I am including another JSP file:
<c:forEach var="instanceVar" items="${instanceList}">
<c:set var="instance"><jsp:include page="instance.jsp"/></c:set>
...
</c:forEach
In the file instance.jsp I want to use a variable instanceVar
. I want to do it using JSTL. Is there any way to do this?
In the
instance.jsp
The solution that work for me is the following
in the jsp file, the code is:
An alternative would be using
setAttribute()
andgetAttribute()
Another alternative is using JSTL tag c:set and request scope.