once again the combination of PrimeFaces and GAE drives me crazy. Inside a p:dataTable I want to click a image, call a bean method and set a parameter. The method is called, but the parameter does not work. Here is a simplified example (without the table):
<h:form id="f1">
<h:outputText id="text" value="#{testBean.index}"/>
<h:graphicImage url="/images/cut.png">
<p:ajax event="click" process="@this" update="text"
actionListener="#{testBean.test}" >
<f:setPropertyActionListener target="#{testBean.index}" value="5" />
</p:ajax>
</h:graphicImage>
</h:form>
My TestBean looks like this:
@javax.faces.bean.ManagedBean @ViewScoped
public class TestBean implements Serializable{
private int index; // getter/setter
@PostConstruct public void init() {
index = 0;log.log(Level.WARNING, "@PostConstruct");}
public void test(ActionEvent ae){
log.log(Level.WARNING, "Index: "+index);}
}
In the Logs I see one @PostConstruct and after clicking the image always Index: 0
Update The value update problem may be discussed here JSF GAE: Value Update Problem in managed bean method
I don’t know much about GAE, so I can’t assume that it isn’t somehow interfering with your code. I don’t necessarily think that the
<f:setPropertyActionListener>is the appropriate tag to use for a<p:ajax>tag however. I don’t believe it accepts that.Here is an example of how I implemented an ajax call to a viewscoped bean property using
<p:commandLink>and an HTML<span>tag.I just set a CSS class to be a static image icon of my choosing, and then clicking on it would invoke a dialog.