IT, computer and programming tutorials and tips that i couldnt find anywhere else using google, from my daily work as a Senior Developer of solutions using Java and Linux.
20140117
[SOLVED] primefaces click on p:commandLink doesn't work, nothing happens. firebug helped me easily find the error.
In firefox, i clicked on the magnifying glass (top left in above image) icon link that seemed to not be working. When i clicked on the image, nothing happened.
I originally tried a (bad and risky) workaround for this by setting the p:commandLink's "immediate" attribute to "true":
<p:commandLink
actionListener="#{lrdm.openTRQDetails(trq.id)}"
update=":growl :panelContent" immediate="true">
<h:graphicImage value="/images/search.gif" style="border:0" />
</p:commandLink>
this "worked", but simply hid the error, so this isn't a solution.
Eventually, I found out that it was a hidden error: java.lang.NullPointerException
Here's how i found that:
In firebug > Console > All
i expanded the POST line and could see a clue about the error in the Response tab:
<?xml version='1.0' encoding='UTF-8'?>
<partial-response><error><error-name>class javax.faces.component.UpdateModelException</error-name><error-message><![CDATA[/path/to/inplaceInputText.xhtml @16,60 value="#{inputValue}": /path/to/tripRow.xhtml @53,69 value="#{backingBean.description}": java.lang.NullPointerException]]></error-message></error></partial-response>
here's the problem code in "backingBean"
...
public void setDescription(String description) {
this.description = description.toUpperCase();
}
...
the error was occurring when "description" was null--toUpperCase() will obviously throw an error.
to fix this, i changed the code to this:
public void setDescription(String description) {
if(description != null)
this.description = description.toUpperCase();
else this.description = description;
}
Once that was fixed, the form submitted properly :)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment