h:commandLink and unsafe-inline

Viewed 621

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?

1 Answers
Related