Saturday, March 14, 2009

What do the differing levels of bean storage (page, session, app) mean (Servlets)

Question :What do the differing levels of bean storage (page, session, app)
mean? (Servlets)

Answer :page life time - NO storage. This is the same as declaring the variable in
a scriptlet and using it from there.
session life time - request.getSession(true).putValue "myKey", myObj);
application level ?
getServletConfig().getServletContext().setAttribute("myKey ",myObj )
request level - The storage exists for the lifetime of the request, which
may be forwarded between jsp's and servlets

No comments: