0
考慮這種情況:套裝屬性之前JSP
<!-- main.jsp -->
<% for (int i = 0; i < 10; i++) { %>
<% request.setAttribute("i", new Integer(i)); %>
<jsp:include page="template.jsp" />
<% request.removeAttribute("i"); %>
<% } %>
<!-- template.jsp -->
<jsp:useBean id="i" scope="request" type="java.lang.Integer" />
<%=i%>
如果我執行main.jsp
我得到這樣的結果:
0 1 2 3 4 5 6 7 8 9
這就是我想要的。
但問題是:
顯示順序將永遠是這樣嗎? 我應該爲請求提供同步嗎?
感謝