Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Implicit Objects scope , lifetime and accessibility

 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

In the JSP specification some implicit object's ( response, pageContext, out, config, page, exception) scope is definded as page. I am little bit confused about this. As the JSP is running in more than one thread processing multiple request in multiple session, it will use the same page, config and other objects. Aslo from the JSP spec., I understand that the JSP page ( implementation class ) have only one instance in the container for most general cases. The references for these objects are stored in pageContext and also available through the scripting language variables. Is it means that these objects are available through pageContext when these are not in scope? If available what are the values for these objects.

Any further clarification on the life-time and scope of these implicit objects?


Thanks
 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Any Answer please ?

Thanks
 
Francois Roland
Ranch Hand
Posts: 34
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you are confusing the local variables which names are the one you gave with the objects they refer to.

Imagin a HttpServletRequest instance. Sure, it has a request scope and not a page scope. But the servlet container creates a variable which name is "request" and stores its content in the page scope. It's a kind of pageScope.setAttribute("request", request).

I hope it will help.
 
P. Dunn
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure this answers your question.

See HFS p.295

It shows how these implicit vars translate into servlet code. Notice page=this; the var page is local, but "this" is the instance of the servlet.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic