dwr的reverse Ajax问题
以下是代码,debug发现getScriptSessionsByPage返回的sessions一直为空的(sessions.size()=0 ),导致无法将数据发送到客户端,是否是("/ABC/chat.jsp)路径问题?但即使使用全路径依然如此。请高手指教。。
WebContext wctx = WebContextFactory.get();
ScriptBuffer script = new ScriptBuffer();
script.appendScript("receivemessage(")
.appendData(message)
.appendScript(");");
ServerContext sctx = ServerContextFactory.get(wctx.getServletContext());
// Push script out to clients viewing the page
Collection<ScriptSession> sessions =
sctx.getScriptSessionsByPage("/TPL/chat.jsp");
System.out.println(sessions.size());
for (ScriptSession session : sessions) {
session.addScript(script);
}