Java Tutorial/JSTL/Variable Scope
Версия от 17:44, 31 мая 2010; (обсуждение)
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" />