• Post Reply Bookmark Topic Watch Topic
  • New Topic

c:set scope option  RSS feed

 
Karthick Natarajan
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

In page 447 of Head First Servlets and JSP, the authors have mentioned that default scope for <c:set> is page scope. Further, in the section "there are no dumb questions" , the authors have mentioned in the second answer that if you do not use scope in the tag, the container will search scope in the following order - page, request, session and then application/context. Only after not finding an attibute in any of the four scopes, the container will create a new attribute in the page(default) scope.

Ok, after that in a thread I looked up to clear my understanding(http://www.coderanch.com/forums/), Kathy has said that the container will look ONLY in the page scope. If it does not find an attribute, in the page scope only, then it will create a new attribute.

So, if i have
request.setAttribute("name", "abc")

and use
<c:set var="name" value="def"/>

and use
${pageScope.name}

Assuming, these are the only attributes,Will I get null(the container searched through all the scopes) or "def" (the container looks in page scope only and creates a new attribute in page scope finding no attribute matching name in page scope).

I am a little confused. Where am I going wrong?

Thanks in advance.
[ January 02, 2006: Message edited by: Nachiketas ]
 
fred rosenberger
lowercase baba
Bartender
Posts: 12558
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nachiketas,

Perhaps you missed our naming policy on the way in. Basically, it requires a real sounding first AND last name.

Please go here and update your display name.

Thanks, and we'll see you 'round the ranch!!!
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!