This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

EL to check session object how?  RSS feed

 
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
Bartender
Posts: 18709
71
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
Bartender
Posts: 18709
71
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!