1

I'm new to RichFaces. I have a requirement to call backingbean method from javascript. I used a4j:jsfuction to do so but I was adviced not to use this component for performance and call backing bean method directly within javascript like below

within javascript:

somemethod('somevalue')

within xhtml:

function somemethod(value){
 #{backingbean.test(value)}
}

Can you please let me know which approach is better and why?

Thanks in advance.

J Dev
  • 11
  • 2

1 Answers1

0

a4j:jsFunction is better since the "pure JavaScript" solution will not work the way you want:

function somemethod(value){
    #{backingbean.test(value)}
}

EL expressions like this will be executed when the page is being rendered, passing the parameter will not work either. Have you actually tried if it works?

Makhiel
  • 3,874
  • 1
  • 15
  • 21