If you look at this Mkyong example of how h:commandLink is resolved, it looks like this.
//JSF
<h:commandLink action="#{user.goLoginPage}" value="Login page + Param ">
<f:param name="username" value="mkyong" />
</h:commandLink>
//HTML output
<script type="text/javascript"
src="/JavaServerFaces/faces/javax.faces.resource/jsf.js?ln=javax.faces&stage=Development">
</script>
<a href="#"
onclick="mojarra.jsfcljs(document.getElementById('j_idt6'),
{'j_idt6:j_idt20':'j_idt6:j_idt20','username':'mkyong'},'');
return false">
Login page + Param
</a>
The problem with this is that if you are enforcing unsafe-inline your browser will refuse to execute this.
I've been whitelisting inline scripts with the nonce method.
Is there a way to allow the h:commandLinks to work?
There is in HTML no way to perform a POST request using an <a> element. JSF in this context being just a HTML code generator can't do much about that.
You have 3 options:
<h:commandButton>.<h:link>.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