Set Variable to Page Context : Page Context « JSTL « Java Tutorial






<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>

<%
  synchronized (pageContext) {
    String[] names = {"A", "B", "C", "D"};
    pageContext.setAttribute("names", names, PageContext.PAGE_SCOPE);
  }
%>

<html>
  <head>
    <title>forEach and status</title>
  </head>

  <body>
    <c:forEach var="currentName" items="${pageScope.names}" varStatus="status">
      Family member #<c:out value="${status.count}" /> is
        <c:out value="${currentName}" /> <br />
    </c:forEach>
  </body>
</html>
  Download:  JSTLSetVariableToPageContext.zip( 1,021 k)








24.26.Page Context
24.26.1.Set Variable to Page Context
24.26.2.Set Class to Page Context
24.26.3.Query String
24.26.4.Check Page Context Request Method