I've some problems with request context. I'm using jsf 1.2 + seam + primefaces 1.0.1.
I have this command button and javascript on my page
Code: Select all
<p:commandButton id="searchAccident" value="Search"
actionListener="#{mainAction.searchAccident}"
oncomplete="openAccidentIfFound(xhr, status, args)">
</p:commandButton>
...
<script type="text/javascript">
//<![CDATA[
function openAccidentIfFound(xhr, status, args) {
alert(status); // <-- this returns a parsererror
alert(args); // <-- null!!!
alert("found:" + args.found);
}
//]]>
</script>
Code: Select all
@Name(value="mainAction")
public class MainAction implements Serializable {
....
Accident accident;
public void searchAccident(ActionEvent event) {
...
RequestContext ctx = RequestContext.getCurrentInstance();
...
ctx.addCallbackParam("found", true);
cxt.addCallbackParam("accidentNumber", accident.getNumber()); // is a String
}
... setters/getters
}
Any thoughts? What am I missing?
Thanks in advance