This content has been marked as final. Show 3 replies
I want to know can we access the session scoped variable in bookdetails.xhtml by simply using its name as done above?Why are you asking this? The example you post is showing exactly that you CAN do it. If you don't want to believe the example - deploy it and run it, or buy a book, or read the JSF specifications.
I have deployed it and executed it. It's working fine.
I just want to verify if my understanding about the topic is correct. I think that there is no configuration required for this feature. Can we use this syntax in any JSF application or only when CDI(context and dependency injection) is being used.
It is basic Expression Language (EL) functionality, it isn't even specific to JSF. And it isn't specific to the session scope either, you can put beans in any scope (page, request, session, application, flash, conversation, whatever custom scope you create) and reference it using EL by only its name. The thing that you have to take care of is that the bean lives in SOME scope, which can be achieved using JSF specific annotations or configuration files, through CDI or by manually putting the bean in a specific scope through Java code. It's flexible, which is the nature of the Java platform.