• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

EL Expression

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
PatienceIsAVirtue

#{topic.addTag('EL parameter')}
 
Rahul Rajagopal
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Wouter ,

I am sorry, you cannot pass parameters like that , it's wrong.
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic