JSR 286 Portlet统计在线用户数

时间:2014-01-10 10:50:48

标签: session portlet jsr286

我想创建一个名为VisitCounter的JSR 286 Portlet,以便在websphere Portal 8.0上安装。 VisitCounter计算在线用户数。

public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException {
        // Set the MIME type for the render response
        response.setContentType(request.getResponseContentType());

        // Check if portlet session exists
        VisitCounterPortletSessionBean sessionBean = getSessionBean(request);
        if( sessionBean==null ) {
            //response.getWriter().println("<b>NO PORTLET SESSION YET</b>");
            return;
        }
        ........
}

如何制作? 谢谢!

1 个答案:

答案 0 :(得分:0)

public void doView(RenderRequest request,RenderResponse response)抛出PortletException,IOException {         //设置渲染响应的MIME类型         response.setContentType(request.getResponseContentType());

    // Check if portlet session exists
    VisitCounterPortletSessionBean sessionBean = getSessionBean(request);
    if( sessionBean==null ) {
        //response.getWriter().println("<b>NO PORTLET SESSION YET</b>");
        return;
    }
    ........

}

使用应用范围...