• 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

Doubt in requestScope

 
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have the following code

This works fine also this.
<p>name--------->${name}</p>
but this doesnt work.


I know that requestScope is a map containing all the request scoped attributes in it.
why does it fail when. I pass an attribute rather than a string.

Thanks
[ November 10, 2008: Message edited by: raja ram ]
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you post the same code twice ? I can't see any difference.
 
raja ram
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have edited the post.

Thanks
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by raja ram:


I know that requestScope is a map containing all the request scoped attributes in it.



you know , it is a map right? then how come it(below one ) will work?


this will work



Hope this helps
 
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Code #1 uses requestScope["name"] to access the request attribute name. This will work as expected.
However requestScope[name] , Here name is without quotes so the

1) container will now search for a attribute "name" in all the 4 scopes one after other and it will find name in request scope with a value "To test thekey and attribute differences"

2) Container will now convert this to
requestScope["To test thekey and attribute differences"] and it will search again a attribute with name = "To test thekey and attribute differences" in all the 4 scopes and it will find none and since EL handles null gracefully it will return empty string.

To confirm the above explanation try this EL empty operator.


Result:
requestScope["name"]--------->To test thekey and attribute differences
requestScope[name]--------->true

Hope its clear
 
raja ram
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Thanks for clearing my doubt.
 
Every time you till, you lose 30% of your organic matter. But this tiny ad is durable:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic