当前位置: 代码迷 >> Java Web开发 >> DWR选择推送有关问题 急
  详细解决方案

DWR选择推送有关问题 急

热度:709   发布时间:2016-04-17 00:39:04.0
DWR选择推送问题 急!
public class OnlineService {
  .....
ublic void send(String sender,
String senderName,
String sendDeptName,
String strResceiver,
String globalFlg,
String callId,
String parUserid,
String modeType,
String FilesId,
String msg,
String roomId,
HttpServletRequest request){
  .....
ServletContext sc = request.getSession().getServletContext();
ServerContext sctx = ServerContextFactory.get(sc);
//获得当前浏览 customerService.jsp 页面的所有脚本session
Collection session = sctx.getScriptSessionsByPage("/oa/modules/online/CallPage.jsp");
Util util = new Util(session);
util.setValue("callId", callId);
util.addFunctionCall("receiveMsg_call", mingcheng,sendDeptName, msg,flag);
  }
  ......

获取了所有浏览CallPage.jsp页面的ScriptSessions,实现推送。现在CallPage.jsp页面有<input type="hidden" name="roomId" id="roomId" value="<%=accId%>"/> 通过roomId来筛选推送。可Util 没有getValue()方法。如何实现。

------解决方案--------------------
不是很懂喃 0.0 不过可以顶下啊
------解决方案--------------------
要么把这个方法推到前端,然后在这个js方法中,取得roomId。继续你的操作。。。
这样还是推到了所有的客户端。

所以最好是客户端主动将roomId发到服务器,然后服务器返回,如果只返回当前客户端,直接用AJAX就可以了,如果要推到其它客户端,那还是要推。。。
  相关解决方案