File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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


bala.T murugan

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="" 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="" target="_blank" rel="nofollow"></a>
I agree. Here's the link:
subject: scope
It's not a secret anymore!