Meaningless Drivel is fun!*
The moose likes Servlets and the fly likes scope Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "scope" Watch "scope" New topic
Author

scope

bala.T murugan
Greenhorn

Joined: Sep 09, 2005
Posts: 9
where are saying different scopes req,session, page where will their corresponding values ae stored ,how come it(server) can differentiate scope
Sravan Kumar
Ranch Hand

Joined: Sep 11, 2005
Posts: 121
It (container) stores the scope attributes in the corresponding objects. Request scope in ServletRequest, Session scope in HttpSession, page scope in JspContext and application scope in ServletContext.

When you try to get the attributes, you call getAttribute() method on the corresponding object and it returns the attribute in that scope.


keep smilin :: sravan<br /><a href="http://sravanpens.blogspot.com" target="_blank" rel="nofollow">I scribble here</a>
Eddy Lee Sin Ti
Ranch Hand

Joined: Oct 06, 2005
Posts: 135
You can access all the scope attributes in Jsp page, using the implicit variable pageContext of type javax.servlet.jsp.PageContext methods: getAttribute(String name, int scope) and setAttribute(String name, Object value, int scope) to access those attribute directly.


SCJP, SCWCD, SCJWS, IBM 700,IBM 701, IBM 704, IBM 705, CA Clarity Technical<br /> <br /><a href="http://eddyleesinti.blogspot.com" target="_blank" rel="nofollow">http://eddyleesinti.blogspot.com</a>
 
jQuery in Action, 2nd edition
 
subject: scope
 
Similar Threads
jsp:getProperty
local varaible doubt
getAttributeScope(String name)
Can you prevent another thread from modifying a collection while you iterate over it in EL?
javax.servlet.ServletException:javax.servlet.jsp.JspException: Cannot find bean: "riga" in any scope