Source Code : Application Object

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

Application Object

//File Name: application_page1.jsp
<%
  String theSharedObject = "JSP is cool";

  application.setAttribute("message", theSharedObject);
%>

<HTML>
  <HEAD>
    <TITLE>Application Object - Page 1</TITLE>
  </HEAD>

  <BODY>
    This page sets data that can be retrieved by other pages in the application.<P>

    Click <a href="application_page2.jsp">here</a> to see this in action.
  </BODY>
</HTML>

//File Name:application_page2.jsp

<%
  // getAttribute() returns a java.lang.Object, so need to cast
  String theSharedObject = (String) application.getAttribute("message");
%>

<HTML>
  <HEAD>
    <TITLE>Application Object - Page 2</TITLE>
  </HEAD>

  <BODY>
    This page retrieves the message that was stored in the <i>application</i> object  by another page.
  <P>
    The message is <b><%= theSharedObject %></b>
  </BODY>
</HTML>


           
       

Thank with us