This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes JSF and the fly likes EL to check session object how? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "EL to check session object how?" Watch "EL to check session object how?" New topic
Author

EL to check session object how?

Davie Lin
Ranch Hand

Joined: Aug 05, 2007
Posts: 294
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

Joined: Jun 25, 2001
Posts: 17161
    
  27



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.


An IDE is no substitute for an Intelligent Developer.
Davie Lin
Ranch Hand

Joined: Aug 05, 2007
Posts: 294
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

Joined: Jun 25, 2001
Posts: 17161
    
  27

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.
 
subject: EL to check session object how?
 
It's not a secret anymore!