如何使 p:graphicImage 可点击并调用 bean 动作 [英] How to make p:graphicImage clickable and invoke bean action
本文介绍了如何使 p:graphicImage 可点击并调用 bean 动作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用
,如下所示:
<h3>国家地图</h3><p:graphicImage id="city"value="#{countryPages_Setup.countryMap}"宽度=250"高度=190"></p:graphicImage>
但这不是可点击的图像.如何使该图像可点击,以便当用户点击它时,我可以调用我想要的托管 bean 操作.
解决方案
用 h:commandLink
/h:link
:
<p:graphicImage id="city"value="#{countryPages_Setup.countryMap}"宽度=250"高度=190"></p:graphicImage></h:commandLink>
I am using <p:graphicImage>
like below:
<div id="mapp">
<h3>Country Map</h3>
<p:graphicImage id="city"
value="#{countryPages_Setup.countryMap}"
width="250"
height="190">
</p:graphicImage>
</div>
But this is not a clickable image. How can I make this image clickable so when user click on it, I can invoke the managed bean action that I want.
解决方案
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>
这篇关于如何使 p:graphicImage 可点击并调用 bean 动作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文