How to make p:graphicImage clickable and invoke bean action

走远了吗. 提交于 2019-11-29 14:49:28

Wrap your image in a h:commandLink / h:link:

<h:commandLink action="...">
  <p:graphicImage id="city"
            value="#{countryPages_Setup.countryMap}"
            width="250"
            height="190">
  </p:graphicImage>
</h:commandLink>

If the p:graphicImage is inside a p:contentFlow, you can use the following:

For me, this works perfectly:

<h:form id="imageFlowForm">
    <p:contentFlow id="imageContent" value="#{controller.allImages}" var="entry">
        <div class="caption">#{entry.name}</div>
        <p:commandLink styleClass="content" action="#{controller.doAction}" update="detailForm">
            <p:graphicImage value="#{entry.imagePreviewUrl}" styleClass="content" width="50px" />
            <f:param name="id" value="#{entry.id}" />
        </p:commandLink>
    </p:contentFlow>
</h:form>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!