Hi I have a graphicalImage and I want a method in the backingBean to be fired up on clicking on the image.Below is the code snippet that i am using but it is not working. Please help.
<h:graphicImage value="../resources/images/delete_button.png"
onclick="editBean.deleteStudyPlan"
style="float:center;height: 18px; width:20px;"
title="Delete the studyplan"/>
You need to wrap it in a
<h:commandLink>or<p:commandLink>and specify theactionthere.Alternatively, you can just specify the image as a CSS background image of the command link or button.
The
onclicksurely isn’t a method expression to a JSF backing bean action method. It’s a JavaScript function handler. JavaScript is an entirely different language which runs in the webbrowser, working on the HTML code produced by JSF.