开发者

How do JSPs render

开发者 https://www.devze.com 2023-01-22 05:57 出处:网络
Let say I have something like this in a JSP: <li> <c:s开发者_Go百科et var=\"sectionId\" scope=\"request\" value=\"${userSession.sect[\'Utilities\'].id}\" />

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消