弹出系统提示
public String noticemessage(){ChatManager.noticeRebackMessage(this.getRequest(), noticemessage);return "this";//本页面}package com.web.utils;import java.util.Collection;import java.util.List;import javax.servlet.ServletContext;import javax.servlet.http.HttpServletRequest;import org.apache.commons.lang.StringUtils;import org.directwebremoting.ScriptBuffer;import org.directwebremoting.ScriptSession;import org.directwebremoting.ServerContext;import org.directwebremoting.ServerContextFactory;import org.directwebremoting.WebContext;import org.directwebremoting.WebContextFactory;public class ChatManager {public static void noticeOrderMessage(HttpServletRequest request, String message, String pps) {WebContext wctx = WebContextFactory.get();ScriptBuffer script = new ScriptBuffer();script.appendScript("receiveMessages(").appendData(message).appendScript(",").appendData(pps).appendScript(");"); //获得DWR上下文ServletContext sc = request.getSession().getServletContext();ServerContext sctx = ServerContextFactory.get(sc);//获得当前浏览 index.jsp 页面的所有脚本sessionCollection<ScriptSession> pages = sctx.getScriptSessionsByPage(request.getContextPath()+"/top.jsp");for (ScriptSession session : pages) {session.addScript(script);}}public static void noticeRebackMessage(HttpServletRequest request, String message) {WebContext wctx = WebContextFactory.get();ScriptBuffer script = new ScriptBuffer();script.appendScript("rebackMessages(").appendData(message).appendScript(");");//script.appendScript("rebackMessages(www);"); //获得DWR上下文ServletContext sc = request.getSession().getServletContext();ServerContext sctx = ServerContextFactory.get(sc);//获得当前浏览 index.jsp 页面的所有脚本sessionCollection<ScriptSession> pages = sctx.getScriptSessionsByPage(request.getContextPath()+"/top.jsp");for (ScriptSession session : pages) {session.addScript(script);}}public static boolean isshow(String userpps,String pps){List<String> list=Tools.getListString(userpps);if(StringUtils.isNotEmpty(pps)){for(String pp:list){if(pps.contains(pp))return true;}}return false;}}