Monday, April 9, 2001 04:42 AM
You can share information among all users of the active JSP application using the
This object, is instantiated once per Java Virtual Machine, and can also be used to communicate with the servlet/jsp container.
There's a limitation: you can define a web site using more than one JVM running jsp/servlet servers, in this case you have more than one application, and then
application object cannot be used as a centralized data storage for global settings.
In this case it's recommended to use a database, or jndi or a centralized xml configuration repository (this is the most recent fashion).
application object exposes those methods:
- Object getAttribute (String name)
- Enumeration getAttributeNames()
- int getMajorVersion()
- int getMinorVersion()
- String getMimeType(String file)
- String getRealPath(String virtualpath)
- URL getResource(String path)
- String getServerInfo()
- log(String msg)
- log(String message, Throwable throwable)
- removeAttribute(String name)
- setAttribute(String name,Object object)
See javadoc api for further informations.