How to use modifers like Ctrl or Shift with jsf.2.x and f:ajax (xmlns:f="http://java.sun.com/jsf/core")?
The code I have is
<h:graphicImage width="400" id="img02" style="background:blue;vertical-align:top"
value="images/img?r=1#{Math.random()}" alt="not found">
<f:ajax event="click" render="@this" listener="#{mBean.handleEvent}" />
</h:graphicImage>
and in the bean
public void handleEvent(AjaxBehaviorEvent event) {
System.out.println("Debug event=" + event.toString());
System.out.println(event.getComponent().getClientId());
}
But I have no idea how I can have a different behavior on ctrl-click and on simply click. Is it possible at all, and if, how can it be done?
EDIT2: now I have a working version that calls the setter and the listener:
<h:form id="vvv" class="small">
<h:graphicImage width="500" id="img2c"
onclick="document.getElementById('#{ckeyX.clientId}').value=event.ctrlKey"
value="images/img?y=#{Math.random()}">
<f:ajax event="click" execute="@this ckeyX"
listener="#{mBean.handleEvent}" render="@this">
</f:ajax>
</h:graphicImage>
<h:inputHidden id="ckeyX" binding="#{ckeyX}" value="#{mBean.keyX}" />
</h:form>
Must have had quite more than just one thick finger on my previous tries.