This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

scope

 
bala.T murugan
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Eddy Lee Sin Ti
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic