I’m using:
Linux
PrimeFaces 3.4.1
Glassfish 3.1.2.2 (build 5)
FireFox 10.0.7
I have a message-driven bean that when fired, I want to send via PrimePush data that will appear in the browser using growl. This is what is in the onMessage() of the MDB. This part seems to work ok as the browser is receiving something.
pushContext = PushContextFactory.getDefault().getPushContext();
pushContext.push("/notifications",
new FacesMessage("Test Summary", "Test Detail"));
When this MDB fires, I get the following from within the firefox error console.
Error: not well-formed
Source File: http://localhost:8080/test/primepush/notifications?X-Atmospheretracking-id=0&X-Atmosphere-Framework=1.0&X-Atmosphere-Transport=long-polling&X-Cache-Date=0&_=1351363941008
Line: 1, Column: 1
Source Code:
{"data":{"summary":"Test Summary","detail":"Test Detail","severity":"INFO 0","rendered":false}}
Error: growl is not defined
Source File: http://localhost:8080/test/test.xhtml
Line: 25
Here’s the code in text.xhtml.
<h:form id="test_form">
<p:growl id="growl" for="items" showDetail="true"/>
<p:socket onMessage="handleMessage" channel="/notifications"/>
<script type="text/javascript">
function handleMessage(data) {
data.severity = 'info';
growl.show([data]);
}
</script>
</h:form>
Try
outside the form
look at: http://www.primefaces.org/showcase/push/facesmessage.jsf