Set Variable Scope to Application : Set « JSTL « Java Tutorial





<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<html>
  <head>
    <title>Set in Scope Examples</title>
  </head>

  <body>
    <c:set var="test" value="Application Level Value" scope="application" />
    <table border="1">
    <tr>
        <td>
          <b>Default Level</b>
        </td>

        <td>
          <c:out value="${test}" />
        </td>
      </tr>
      <tr>
        <td>
          <b>Page Level</b>
        </td>

        <td>
          <c:out value="${pageScope.test}" />
        </td>
      </tr>

      <tr>
        <td>
          <b>Request Level</b>
        </td>

        <td>
          <c:out value="${requestScope.test}" />
        </td>
      </tr>

      <tr>
        <td>
          <b>Session Level</b>
        </td>

        <td>
          <c:out value="${sessionScope.test}" />
        </td>
      </tr>

      <tr>
        <td>
          <b>Application Level</b>
        </td>

        <td>
          <c:out value="${applicationScope.test}" />
        </td>
      </tr>
    </table>
  </body>
</html>
  Download:  JSTLSetVariableScopeApplication.zip( 1,246 k)










24.9.Set
24.9.1.JSTL Set Without Body
24.9.2.JSTL Set With Body
24.9.3.Set Value for Variable
24.9.4.Set Comma Delimited String to Variable
24.9.5.Remove Variable
24.9.6.Set Variable To Page Scope
24.9.7.Set Variable Scope to Request
24.9.8.Set Variable Scope Page
24.9.9.Set Variable as Session Scope
24.9.10.Set Variable Scope to Application
24.9.11.Do Calculation In Set