• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EL Expression

 
Rahul Rajagopal
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried searching for it? Because I found it in less then 30 seconds.
 
Rahul Rajagopal
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
PatienceIsAVirtue

#{topic.addTag('EL parameter')}
 
Rahul Rajagopal
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Wouter ,

I am sorry, you cannot pass parameters like that , it's wrong.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18098
50
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic