How to make p:graphicImage clickable and invoke bean action

后端 未结 2 1359
时光取名叫无心
时光取名叫无心 2020-12-21 05:25

I am using like below:

Country Map

相关标签:
2条回答
  • 2020-12-21 05:55

    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>
    
    0 讨论(0)
  • 2020-12-21 06:12

    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>
    
    0 讨论(0)
提交回复
热议问题