I want to put a variable in the requestScope
so I can use it in an other page. Unfortunately, the requestScope
is totally empty in this other page. In fact, when I print #{requestScope}
in both pages, they don't have the same memory adresse !
<c:set var="foo" value="${myForm.myJavaObject}" scope="request" />
<c:forEach var="scope" items="${requestScope}">
${scope.key} // PRINTS EVERY VARIABLE IN THE REQUEST SCOPE, INCLUDING foo
</c:forEach>
<jsp:include page="./includedPage.jsp"/>
<c:forEach var="scope" items="${requestScope}">
${scope.key} // PRINTS NOTHING
</c:forEach>
Same thing if try different scopes (session, application etc.). I don't get it. This method is all over the internet, so why is it not working? First time I use it.
It works if I include <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
. I don't get why though, as it is already included in the mainPage.jsp
and because <jsp:include>
is dynamic.