Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can request and session attribute share the same name

 
Kalyana Sundaram
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can request and session attribute share the same name. In that case will there be any loss of attributes.
My question is, will I be able retrieve both the attributes in session and request that have same name...

Thanks in Advance
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64843
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"kalyan",

We're pleased to have you here with us on the Ranch, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
Forum Bartender
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64843
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With regards to your question, the answer is yes.

Though be aware that in certain circumstances, the request-scoped variable will hide the session-scoped variable (e.g. in unqualified EL references to the scoped variable, or when using PageContext.findAttribute())
 
Kalyana Sundaram
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assume that the attribute "name" is in bith session and request scope....
if i use someting like
<c ut value=${'name'}/>
So the request scope variable would hide the session scoped variable.
If i were to get the session scope variable , i will have to use
<c ut value=${'name'}scope="session"/>

Is this right ???
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64843
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not quite. To retrieve the session-scoped variable you would use:



P.S. When posting code, be sure to click the 'disable smilies' checkbox near the bottom of the page. That way your <cut> tags will look less surprised.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic