I\'m new to jsf. I have been trying to do a simple Javascript function with commandbutton. I tried many times but wasn\'t even able to do an alert message. This is part of my co
Apart from this lowercase/uppercase typo (which wouldn't cause the function not being called at all, by the way), your concrete problem is caused because this page is been designed as a template client using
. Any content outside the
tag is ignored during runtime by Facelets. This content is only useful for visual web designers, but once it's compiled and executed during runtime, it's ignored altogether. Instead the composition's content will be inserted in the master template, the commonLayout
in your case.
You need to put the element inside an
instead, this way it will be taken into the final Facelets composition.
...
Or, better, put the JS function in its own JS file in the /resources
folder and reference it as follows:
...
Thanks to the target="head"
, it'll automatically be relocated into the HTML during building the view.