这是commandButton
实现带参数重定向的方式。
<h:commandButton value="Check" action="#{GetInfoBean.getInfo}">
<f:param name="ID" value="4"></f:param>
</h:commandButton>
点击此commandButton
后,它会传递名为ID
的参数,其值为4
。托管bean GetInfoBean
的方法getInfo()
将返回新的URL。
但是现在,我的问题是如何使用image
或graphicImage
实现此重定向流程,因为它没有action
属性?
答案 0 :(得分:3)
使用<h:commandLink>
包裹图像:
<h:commandLink value="Check" action="#{GetInfoBean.getInfo}">
<f:param name="ID" value="4"></f:param>
<h:graphicImage value="/your/image.png" />
</h:commandLink>