3 Replies Latest reply on May 13, 2008 11:08 AM by je le

    Need a portlet that display "logged in as: xxx"

    Robert Su Newbie

      Someone please help tell how to write a simple portlet that shows "loged in as : username"; we are frustrated by the lack of docs. Please simply point out which packages are needed to import in order to do this and we can handle the rest. Thanks a million!!

        • 1. Re: Need a portlet that display
          Thomas Heute Master

          Did you even read the portlet spec ?

          • 2. Re: Need a portlet that display
            pmn92 Novice

            In your jsp layout you can use the following :

            <div id='dashboardnav'>
            <p:region regionName='dashboardnav' regionID='dashboardnav'/>
            </div>
            


            But this generates an html/ javascript error.

            In addition, this is undocumented. It it adds a few things related to the dashboard thing. A similar thing is used for the navigation tabs.

            You can write a portlet with no decoration (empty renderers) to produce the DIVs you need and use CSS styles to place it on the page.

            To write your own portlet you can start with examples.

            • 3. Re: Need a portlet that display
              je le Newbie

               

              "sky2rain" wrote:
              Someone please help tell how to write a simple portlet that shows "loged in as : username"; we are frustrated by the lack of docs. Please simply point out which packages are needed to import in order to do this and we can handle the rest. Thanks a million!!


              the answer is actually in the doc...
              http://docs.jboss.com/jbportal/v2.2/javadoc/javax/portlet/PortletRequest.html#getRemoteUser()

              which could translate into :
               public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException {
              //.....
              String login = request.getremoteUser();
              request.setAttribute("login", login );
              .....
              }
              

              and use el into your jsp ${login}
              If null : not yet logged.
              If you need more information than login, you should call mbean ; there're posts in the forum archives.