• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

c:set scope option

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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(https://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 ]
 
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!!!
 
reply
    Bookmark Topic Watch Topic
  • New Topic