Reputation: 2436
I want to be able to pass a value of javascript function to an ui:parameter
like this:
<ui:param name="paramName" value="someWidget.function()"/>
But this obviously does not work (it thinks that: someWidget.function()
is a string parameter).
If I try:
<ui:param name="paramName" value="#{someWidget.function()}"/>
It thinks that someWidget
is a bean name.
Is there any way to place there a value of javascript function on a widget? If not, what would be ideal way of including a value of javascript function in a parameter in JSF?
Upvotes: 1
Views: 2599
Reputation: 1108722
There's a major conceptual misunderstanding going on. JSF runs in webserver and produces a HTML page with therein some CSS/JS code which get delivered to the webbrowser. That HTML page with CSS/JS in turn runs in webbrowser. JS thus definitely doesn't run in webserver "in sync" with JSF somehow. To JSF, JS is like HTML just part of template text which it needs to produce.
You need to look for the solution in a different direction. As the concrete functional requirement is unclear, I can't give any hints in the right direction nor kickoff examples. To the point, you should perform it in Java instead of JS, or to let JS during page load send an ajax request with the desired variable as request parameter.
Upvotes: 4