Java Tutorial/JSTL/Variable Scope

Материал из Java эксперт
Перейти к: навигация, поиск

JSTL Scope Demo

   <source lang="java">

<%@ taglib uri="http://java.sun.ru/jstl/core" prefix="c" %> <c:set var="scopeVarPage" value="Page Value" scope="page" /> <c:set var="scopeVarRequest" value="Request Value" scope="request" /> <c:set var="scopeVarSession" value="Session Value" scope="session" /> <c:set var="scopeVarApplication" value="Application Value" scope="application" /> <html>

 <head>
   <title>Scope Example</title>
 </head>
 <body>

Main File: index.jsp

Scoped Variable Current Value
       Page Scope
(scopeVarPage)
 
       <c:out value="${scopeVarPage}" />
       Request Scope
(scopeVarRequest)
 
       <c:out value="${scopeVarRequest}" />
       Session Scope
(scopeVarSession)
 
       <c:out value="${scopeVarSession}" />
       Application Scope
(applicationVarPage)
 
       <c:out value="${scopeVarApplication}" />
   

<jsp:include page="included.jsp" />