Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how can I make application-wide objects ? 1

Status
Not open for further replies.

lovekang

Programmer
Feb 16, 2006
86
0
0
KR
how can I make application-wide objects ?

for example, counter for all jsp pages, servlets etc.

TIA.
 
I don't mean sessions.

every session and every jsp, servlet should use the object.
 
Code:
application.setAttribute("name", theObject);

perhaps?

Tim
 
From
You can use JSP's built in facility, session and application objects for caching. session object is available for a user session across multiple requests and application object is available for all users using the application. You can cache data into these objects and get this cached data whenever you require. The methods that support caching are.

session.setAttribute(String name, Object cacheableObject);

session.getAttribute(String name);

application.setAttribute(String name, Object cacheableObject);

application.getAttribute(String name);

Cheers,
Dian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top