//File Name: application_page1.jsp
<%
String theSharedObject = "JSP is cool";
application.setAttribute("message", theSharedObject);
%>
Application Object - Page 1
This page sets data that can be retrieved by other pages in the application.
Click here to see this in action.
//File Name:application_page2.jsp
<%
// getAttribute() returns a java.lang.Object, so need to cast
String theSharedObject = (String) application.getAttribute("message");
%>
Application Object - Page 2
This page retrieves the message that was stored in the application object by another page.
The message is <%= theSharedObject %>