posted 12 years ago
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 ]
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 ]
posted 12 years ago
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!!!
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!!!
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors