May 2001
Intermediate to advanced
1088 pages
30h 13m
English
The HttpSession class stores data items on a per-user basis. Sometimes, however, you have data that you need to share between various servlets and Java Server Pages that doesn't need to be stored for each user. For example, if you are writing a database application, you might need to share a database connection. From a Java Server Page, you can store data in the application object. The methods for storing data in the application object are identical to the ones for the session object:
public void setAttribute(String name, Object value) public Object getAttribute(String name) public void removeAttribute(String name, Object value)
From a JSP, if you want to store information in the application object with a name ...
Read now
Unlock full access