posted 10 years ago
I'm probably going to miss something, since when a post is taller than my screen, I lose track of details. But here's some information that should help:
UEL is the same in both Tomcat and Glassfish, so EL coding doesn't change and you don't have to add EL support jars on either platform.
What I meant was that to work "properly", your EL expression should have looked more like this:
Although that's not legal XML
In reality, it's much simpler to get outputText for a string literal:
Or, for cases where the name is a backing bean property:
Backing beans are POJOs (JavaBeans) and the same terminology and conventions apply to them as apply to any other JavaBean. Properties are value holders and are accessed via get/set methods. Backing beans of course may have action methods and listener methods as well. That, however, doesn't make them Controllers in Model/View/Controller parlance, since a Controller transfers values between Model and View and those methods don't do that, JSF itself does.
A Managed Bean is simply a Backing Bean which can be automatically instantiated by JSF using its no-argument constructor. Any time you reference a Backing Bean that doesn't already exist, if it's defined as a Managed Bean, JSF will automatically construct it and inject any Managed Property values. This is a hallmark of the Inversion of Control (IoC) paradigm. The Managed Bean capability allows on-demand construction instead of making you have to explicitly code logic to create backing beans and store them in an appropriate context (request, View, Session, or Application).
The Managed Bean functionality is not likely to go away anytime soon. There is a general-purpose JSR that defines a more generalized version of this functionality, named CDI, but the ability to dynamically construct and initialize beans remains and only the annotations change. The new system is designed to make beans more portable/reusable and to add some additional functionality such as is offered by the Spring Framework, for example. So far I've avoided it myself, since you have to have a certain minimum JEE version support in your server and - more importantly - I found CDI both less capable than Spring and unwilling to allow a clean migration path for my existing Spring code.
Experience keeps a dear School, but Fools will learn in no other.
---
Benjamin Franklin - Postal official and Weather observer