Cacheing
Cacheing

Reputation: 3471

How to implement the image redirect with parameters?

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?

Upvotes: 0

Views: 591

Answers (1)

Luiggi Mendoza
Luiggi Mendoza

Reputation: 85779

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>

Upvotes: 3

Related Questions