0

What is the difference between jsf command button

action = "#{bean.methodName()}" and action = "#{bean.methodName}"

or both are same?

Jasper de Vries
  • 19,370
  • 6
  • 64
  • 102
Albin
  • 1,929
  • 2
  • 14
  • 18

1 Answers1

-2

No difference at all - they look different for historical reasons only.

A couple of JSF versions back, no parameters were allowed in actions, so only the second notation made sense. Those were the times when parameters (of sorts) had to be passed using the notorious setPropertyActionListener.

fdreger
  • 12,264
  • 1
  • 36
  • 42
  • *"A couple of JSF versions back, no parameters were allowed in actions"* This is not true. EL 2.2+ can be used in JSF 1.0 too. – BalusC Nov 14 '16 at 08:48
  • @BalusC - Bold claim. How about a wager? My humble theory is that JSF 1.0 and 1.1 had their own EL implementation, hosted in javax.faces.el package, which was deprecated after introducing the Unified Expression Language in jsf 1.2. Original specs for JSF 1.0 contain the definition of the method expression syntax - in chapter 5.2.1. Look it up and perhaps undownvote my - perhaps incomplete, but correct - answer. – fdreger Nov 14 '16 at 12:45
  • @BalusC: do you still uphold your theory? Or do you think mine (about original coupling of JSF and EL) is more correct? – fdreger Nov 15 '16 at 12:13
  • @BalusC So, do you still think there's something wrong with my answer? If you know something I don't, I'll be happy to correct it. – fdreger Nov 19 '16 at 13:44