I'm trying to run some basic javascript code with JSF 2. I'm using the following code to do so:
<h:outputScript target="head">
var props = $.event.props;
</h:outputScript>
Looking at the source of the page I can't find any evidence of this code.
I thought that was the correct way to work with javascript code in JSF.
Should I use the <script>
tag of html instead?
Thanks!
That's not the intend purpose of the outputScript
tag. It just renders an HTML script
tag while resolving the location of the javascript file that's specified in its name
attribute.
If you need to inline javascript, just enclose it in the <script>
tag directly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With