Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Get the current user Liferay using a simple Java code

    • 0
    • 3
    • 3
    • 1
    • 0
    • 0
    • 0
    • 0
    • 1.20k
    Comment on it

    Get Current User in Liferay:- We can find the current logged in user in liferay using the below code Script. There are two methods to get the current User of liferay as following:

    1. we can directly use the PortalUtil class in Liferay.

     PortalUtil.getUser(request).getFullName())
    

    2. But we cannot access directly PortalUtil class in any where so we can use below code to get the current user with the help of ThemeDisplay Class.

    ThemeDisplay themeDisp = (ThemeDisplay)request.getAttribute(WebKeys.THEME_DISPLAY);
    System.out.println("Current---------->"+themeDisp.getUser().getFullName());
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: