I’m using JSTL to import a form from my main page.
<c:import url = "/import/form/registerForm.jsp" />
The main page receives a attribute named registerError from a Servlet. This attribute is available from my main page but it disappears in my registerForm.jsp file
<c:if test = "${!empty registerError}">
<div id = "error">
<p><c:out value="${registerError}" /></p>
</div>
</c:if>
I’ve red that the attributes can be passed through import but as a GET method. Is there any other way to manage this problem?
Just use
<c:import>allows getting a resource from anywhere (including resources external to the webapp), and thus generates a new request, different from the original one, to get the resource.<jsp:include>uses the request dispatcher, and the same request is thus used.