Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EL to check session object how?

 
Davie Lin
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey everyone

If I have a User object and its store in session map like



What are the EL syntax I need to access the session object, in struts I use ${sessionScope}

Thanks
 
Tim Holloway
Saloon Keeper
Posts: 18303
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


However, it's not recommended practice to name objects using an initial capital letter.

You can also reference using an explicit scope notation, but I've never needed to do that so far. Since it's also not advisable to name scoped objects with the same name in different scopes.
 
Davie Lin
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe I visited the official JSF site about EL syntax from oracle.

looks like JSF can use the same implicit object like sessionScope in JSP. That should be no problem if I am using Facelets instead right?

I will remember the naming convention you mentioned

Thanks Tim
 
Tim Holloway
Saloon Keeper
Posts: 18303
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Even in basic JSP, it was usually possible to omit the scope and have it determined implicitly. EL continues that tradition. While it may make the process of resolving objects slightly less efficient, since multiple scopes have to be searched, the payback is the flexibility of not having to change all your references if the scope needs to be changed.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic