Search code examples
jsfprimefacesmouseoveractionmethodgraphicimage

How to call a bean method when mouse over on a graphicImage?


I have the requirement that on mouse over of a <p:graphicImage> a JSF backing bean method should be called which will display some data dynamically.

How can I achieve this? Please don't suggest me JavaScript code.


Solution

  • This link shows that <h:graphicImage> supports the mouseover event. Since you are using Primefaces, you should be able to do something like

    <h:graphicImage ...>
        <p:ajax event="mouseover" actionListener="myMethod"/>
    </h:graphicImage>