您的位置:首页 > 其它

ie内核出现问题的解决方法

2011-03-21 23:44 302 查看
olinecount.jar 代码

加入was 类j2ee.jar 在放入portal share里面的ext 下面

package com.gzepro;

public class SessionCounter implements javax.servlet.http.HttpSessionListener
{
    //定义静态变量保存在线人数
    private static int activeSessions = 0;

    public SessionCounter()
    {
    }

    public void sessionCreated(javax.servlet.http.HttpSessionEvent arg0)
    {  //如果会话创建则把在线人数加1
        activeSessions++;
     
    }

    public void sessionDestroyed(javax.servlet.http.HttpSessionEvent arg0)
    {  //在会话被关闭的时候,如果在线人数大于0,则减1
        if (activeSessions > 0)
            activeSessions--;
     
    }
   //返回在线人数
    public static int getActiveSessions()
    {
        return activeSessions;
    }

}

 

 

在主题里部署监听器

操作之前要先备份目录wps.ear 防止删除skin them
导出wps.ear wsadmin.bat -user wpsadmin -password admin  -c "$AdminApp export wps c:/wps.ear"  如果出错检查soap端口 -port 10033 这里如是系统是linux 的"$AdminApp export wps c:/wps.ear"  "  改成 '
展出wps.ear  EARExpander.bat -ear c:\wps.ear -operationDir c:\wps_expanded -operation expand
展入wps.ear  EARExpander.bat -ear c:\wps.ear -operationDir c:\wps_expanded -operation collapse
导入wps.ear  wsadmin.bat -user wpsadmin -password admin -port 10033 -c "$AdminApp install c:/wps.ear {-update -appname wps -nodeployejb}"  如果出错检查soap端口 -port 10033

 

them skin要重新布置

在web.xml文件中加入:
   <listener>
    <listener-class>
      com.gzepro.SessionCounter
    </listener-class>
    </listener>

在页面的js当中加入

<script>
 window.onbeforeunload  =  function()  
       {  
            if((event.clientX>document.body.clientWidth&&event.clientY<0)||event.altKey)  
            {         
                 alert("close");
                 window.location.href="<portal-navigation:url command='LogoutUser'/>"; //关闭页面注销session
            }
            else
            {
                 alert("refsh");
            }
        }
</script>

 

在jsp的页面里引入 import="com.gzepro.SessionCounter",再 加入<%= SessionCounter.getActiveSessions() %>即可,这里直接调用监听器的方法获得用户数。

参考资料:http://www.webspherechina.net/?492/viewspace-1108.html  

oliverchan

 

wp 5.0在线统计 http://swcracker.itpub.net/post/28352/269976  swcracker的博客
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: