Source Code : Variable scope: page, session and application
Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com.
Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com.
Click Here or search from google with Libraries Name you get jar file related it
Variable scope: page, session and application
//File: index.jsp
<%@ taglib uri="http://java.sun.com/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>
<h3>Main File: index.jsp</h3>
<table border="1">
<tr>
<th>Scoped Variable</th>
<th>Current Value</th>
</tr>
<tr>
<td>
<b>Page Scope</b>
(scopeVarPage)</td>
<td> 
<c:out value="${scopeVarPage}" />
</td>
</tr>
<tr>
<td>
<b>Request Scope</b>
(scopeVarRequest)</td>
<td> 
<c:out value="${scopeVarRequest}" />
</td>
</tr>
<tr>
<td>
<b>Session Scope</b>
(scopeVarSession)</td>
<td> 
<c:out value="${scopeVarSession}" />
</td>
</tr>
<tr>
<td>
<b>Application Scope</b>
(applicationVarPage)</td>
<td> 
<c:out value="${scopeVarApplication}" />
</td>
</tr>
</table>
<br />
<br />
<jsp:include page="included.jsp" />
<br />
<br />
<a href="linked.jsp">[Click Here to View: linked.jsp]</a>
</body>
</html>
//////////////////////////////////////////////////////////////////////////////////////////
//File: linked.jsp
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<html>
<head>
<title>Scope Example</title>
</head>
<body>
<h3>Linked File: linked.jsp</h3>
<table border="1">
<tr>
<th>Scoped Variable</th>
<th>Current Value</th>
</tr>
<tr>
<td>
<b>Page Scope</b>
(scopeVarPage)</td>
<td> 
<c:out value="${scopeVarPage}" />
</td>
</tr>
<tr>
<td>
<b>Request Scope</b>
(scopeVarRequest)</td>
<td> 
<c:out value="${scopeVarRequest}" />
</td>
</tr>
<tr>
<td>
<b>Session Scope</b>
(scopeVarSession)</td>
<td> 
<c:out value="${scopeVarSession}" />
</td>
</tr>
<tr>
<td>
<b>Application Scope</b>
(applicationVarPage)</td>
<td> 
<c:out value="${scopeVarApplication}" />
</td>
</tr>
</table>
</body>
</html>
//////////////////////////////////////////////////////////////////////////////////////////
//File: included.jsp
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<table border="1">
<tr>
<th>Scoped Variable</th>
<th>Current Value</th>
</tr>
<tr>
<td>
<b>Page Scope</b>
(scopeVarPage)</td>
<td> 
<c:out value="${scopeVarPage}" />
</td>
</tr>
<tr>
<td>
<b>Request Scope</b>
(scopeVarRequest)</td>
<td> 
<c:out value="${scopeVarRequest}" />
</td>
</tr>
<tr>
<td>
<b>Session Scope</b>
(scopeVarSession)</td>
<td> 
<c:out value="${scopeVarSession}" />
</td>
</tr>
<tr>
<td>
<b>Application Scope</b>
(applicationVarPage)</td>
<td> 
<c:out value="${scopeVarApplication}" />
</td>
</tr>
</table>
Thank with us