JSR 286 Portlet Count the number of user online

137 Views Asked by At

I want to create a JSR 286 Portlet named VisitCounter to install on websphere Portal 8.0. VisitCounter counts the number of user online.

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;
        }
        ........
}

How to make this? Thanks!

1

There are 1 best solutions below

0
On

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;
    }
    ........

}

Using application scope...