How does the "session" scope work with the useBean tag? What is the difference between "session" and "application" for the useBean tag?

Kellan Elliott-McCrea

When you request a bean from the session scope or the application scope, and such a bean already exists, the reference to the existing bean is returned, and a new bean is not instantiated; otherwise, the bean is newly instantiated, placed into the specified scope, and the reference is returned.

The session scope is different then the application scope in that an application bean is kept around until the servlet/jsp container is restarted, while session beans time out after a specified amount of inactivity or if the session is invalidated for any reason. Also, beans with session scope are available only to a single client which participates in the session; beans with application scope have "global" visibility and are available to all JSPs and servlets which are part of the application.

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact