0

This is the way how a commandButton realizes the redirect with parameters.

<h:commandButton value="Check" action="#{GetInfoBean.getInfo}">
<f:param name="ID" value="4"></f:param>
</h:commandButton>

When this commandButton get clicked, it will pass the parameter named ID with value 4. The managed bean GetInfoBean's method getInfo() will return the new url.

But now, my question is how can I implement this redirect process using image or graphicImage since it doesn't have the action attribute?

4

1 回答 1

3

Wrap the image using a <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>
于 2013-03-29T16:51:10.473 回答