I would like to use the commands:
The JSF <h:commandButton>
generates an <input...>
but I would like that instead of generating the <input>
I would like that this generate a HTML 4 standard<button>
.
Closest what you can get with standard JSF component set is <input type="button">
which is generated by <h:button>
.
<h:button value="Button" />
which generates
<input id="j_id_1" name="j_id_1" type="button" value="Button" onclick="window.location.href = '/context/currentpage.xhtml'" />
If you really insist in using <button>
for some unclear reason, then you have the following options:
<p:button>
generates a <button>
.You should look into the Primefaces p:commandButton
. This will render to a <button>
tag on the client.
http://www.primefaces.org/showcase/ui/commandButton.jsf
If you are using JSF 2.2, you can just use the <button>
tag with jsf namespace mixed. The secret here is the attribute process
from jsf
namespace, that post the form data, and the action
attribute.
<button type="submit" class="btn btn-primary"
jsf:action="#{profileController.updateProfile}"
jsf:process="@form">
<i class="fa fa-floppy-o" aria-hidden="true"></i>
#{bundle['button.store']}
</button>
In JSF 2.2 you can use any HTML tag mixing with JSF tags.
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