wood burning stoves 2.0*
The moose likes JSF and the fly likes EL Expression Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSF
Bookmark "EL Expression" Watch "EL Expression" New topic
Author

EL Expression

Rahul Rajagopal
Greenhorn

Joined: Sep 21, 2010
Posts: 7
Hi,


How to write an EL expression for passing parameter values to a method in a java class?


Thanks in advance.
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

Have you tried searching for it? Because I found it in less then 30 seconds.


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Rahul Rajagopal
Greenhorn

Joined: Sep 21, 2010
Posts: 7
Hi Wouter ,

For the last two days i have been searching for it ,but didn't get any successful information. Please help me it is very urgent....


Thanks in advance.
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

PatienceIsAVirtue

#{topic.addTag('EL parameter')}
Rahul Rajagopal
Greenhorn

Joined: Sep 21, 2010
Posts: 7
Hi Wouter ,

I am sorry, you cannot pass parameters like that , it's wrong.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16096
    
  21

Rahul Rajagopal wrote:Hi Wouter ,

I am sorry, you cannot pass parameters like that , it's wrong.


It's wrong in the sense that JSF is a Model/View/Controller architecture, and the View has no business having any logic on it that doesn't directly impact the view. Otherwise the lines between Model, View and Controller get muddied and you lose its advantages - including knowing where to look when it comes time to maintain it.

JSF1 didn't permit parameterized EL at all. JSF2 relaxes some of those limitations, but that doesn't mean they should be abused any more than the fact that there are are at least 2 different ways to code loops on a JSF View means that you should use looping to do things that a dataTable was meant to do.

Very specifically, you can't call methods - with or without parameters - from a JSF view. You can reference properties, but properties, by definition don't take parameters because they are data references (subscripts and sub-properties don't count as parameters). In JSF1, action methods couldn't take properties, either.

In JSF 2, like I said, there are more options, but a View can't go calling methods right and left. Discounting any AJAX stuff going on, a View just sits there until you fire off an action. And unless you bind listeners, only one action can fire per request.

So yes, it's wrong, and not just because EL isn't co-operating.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
GeeCON Prague 2014
 
subject: EL Expression