Search |
||
Using JSP Immediate Expressions to access JSF DataPosted by edburns on March 15, 2006 at 10:48 AM PST
Here is an ultra-quick blog entry sharing something in JSF 1.2 about which I'm not sure many people are aware. Thanks to the unified EL, it is possible to refer to JSF managed beans and other JSF concepts using plain old JSP expressions in the page. For example, let's say you have a JSF app that is a bookstore. In the app is a managed bean that is a Map where the keys are ISBN numbers and the values are Book JavaBeans that have properties like author, title, ISBN, etc. In JSF 1.1, to display any information from the book Map, you had to use JSF components. In JSF 1.2, you can use plain old JSP ${} expressions to access this data, like this:
Even though Keep in mind that you can also access all the implicit objects, including JSF ones, in this manner. For example, if you wanted to use EL to get the locale of the current view, you could say:
As a final example, if you wanted to get the remote user name of the current user using standard Servlet authentication APIs you could say:
Basically anything that conforms to JavaBeans naming conventions and
is accessible from the »
Related Topics >>
Java Enterprise Comments
Comments are listed in date ascending order (oldest first)
|
||
|
|