Why is the h:commandButton
not working?
Your problem is number 1 in the answer you have checked.
UICommand and UIInput components must be placed inside an UIForm component, e.g.
<h:form>
.
Why is the h:button
working then ?
from the h:button
docs:
Render an HTML "input" element of type "button". The value of the component is rendered as the button text and the outcome of the component is used to determine the target URL which is activated by onclick.
So ...
JSF will put your h:button
outcome
value in a javascript function that will be executed at an onclick
event. But it will execute the action
of the h:commandButton
on the form submit with the POST
method, so there should be a form to submit.