• 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

c:set scope option  RSS feed

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

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: 12628
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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!!!
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!