How do JSPs render
Let say I have something like this in a JSP:
<li>
<c:s开发者_Go百科et var="sectionId" scope="request" value="${userSession.sect['Utilities'].id}" />
<a class="header" href="#category-2">Cat 2</a><c:import url="/resources/softwareCategoriesAccordion.jsp"/>
</li>
<li>
<c:set var="sectionId" scope="request" value="${userSession.sect['Games'].id}" />
<a class="header" href="#category-3">Cat 3</a><c:import url="/resources/softwareCategoriesAccordion.jsp"/>
</li>
The imported page uses the variable that is set to pull some info, but when the page is rendered it has the "Games" info twice. Why is Utilities missed?
This is on Tomcat 4.1.
<c:import>
fires a brand new HTTP request. The imported resource does not share the same HTTP request as the JSP you're currently sitting in. So it won't see the request attribtues you've set.
Use <jsp:include>
instead.
精彩评论