Can anyone please tell me how to pass a parameter from EL expression to Managed Bean method? I am using jsf1.2, facelets. I read somewhere that there is a standard way to do it in JSF 1.2. I have done it in jsf1.1, but had to create my own implementation of HashMap. If there is something already out there, then I would like to avoid doing that in JSF 1.2.
Wanna install linux on a vacuum cleaner. Could anyone tell me which distro sucks better?
I believe that there's an example of this at IBM DeveloperWorks. I don't recall the URL. They didn't use it the way you're doing, however. They were doing custom validators, I believe. Note also that this isn't a JSF thing, it's a Facelets thing and it applies to static functions, not instance functions (that is, in managed beans). I think the JSF1.2 stuff is actually due to Facelets being merged into JSF proper, but I'd have to RTFM.
EL is a very powerful and very useful facility, but it should be used advisedly (unfortunately a lot of people don't). Adding custom functions to the EL language isn't a trivial task, and the results may not be easily reusable in future-generation apps unless well designed. Not that anything is as reusable as we wish, well-designed or not.
The more compelling reason to go light on the EL is that it risks pushing model/controller/backend logic into the View, which is also why I recommend not mixing in JSTL and JSF. There's a reason for having a Model/View/Controller paradigm. It makes complex UI stuff simpler by designating where in the overall structure you find specific functions so that you don't have to play hide-and-seek for them and you'll know how they interact.
Generally, given a choice between complex EL and a backing bean property, I'll go with the property. In some cases, this means constructing the backing bean or members of the backing bean as decorators for more general-purpose beans such as domain model objects.
In the case of a display property like what you're doing, another option might be a formatter. Since the whole purpose of a backing bean is to provide the MVC model object, actually generating a "property" dynamically for output is not something you'd normally do. Value properties are normally simpler and more efficient when backed by internal instance members. My main use for virtual properties is for display control where I'd use them (for example) to provide a context-sensitive value for the "disabled" and "rendered" attributes.