我使用的是:
Linux
PrimeFaces 3.4.1
Glassfish 3.1.2.2 (内部版本5)
FireFox 10.0.7
我有一个消息驱动的bean,当它被触发时,我想通过PrimePush发送数据,这些数据将使用growl出现在浏览器中。这是MDB的onMessage()中的内容。这部分似乎工作正常,因为浏览器正在接收一些东西。
pushContext = PushContextFactory.getDefault().getPushContext();
pushContext.push("/notifications",
new FacesMessage("Test Summary", "Test Detail"));当这个MDB启动时,我从firefox错误控制台中得到以下信息。
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以下是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>发布于 2012-10-30 02:04:03
试一试
<p:growl widgetVar="growl" showDetail="true" /> 在表单之外
查看:http://www.primefaces.org/showcase/push/facesmessage.jsf
https://stackoverflow.com/questions/13103276
复制相似问题