I'm relatively new to JSF (using JSF 2.0).
I'm aware there are other solutions, but I'm not crazy about them:
- pass 'var a' as a parameter: f(a)
Is it possible to do via JSF?
I believe that the best solution would be to use JSF-AJAX(A4J) combination to accomplish desired effect. If you are interested in creating dynamic js and you can abandon the power of JSF managed bean then JSP is probably your choice. On the other hand you can always reference dynamic components value as the following code (provided you have ie. a form named "myForm" with <h:inputText> named "myInput"
Personally, I recommend passing parameters. Inlining hard values into the JS code can be a real problem. It's harder to debug, I think, and you have to be REAL careful that the JS isn't cached and you end up running stale JS code.
Sometimes the only way things ever got fixed is because people became uncomfortable.