How can I get the current user in Liferay?

后端 未结 3 817
情话喂你
情话喂你 2020-12-30 04:52

How can I get the current user connected to a Liferay portal with a simple Java code?

I\'m using Liferay 6.0.6

3条回答
  •  误落风尘
    2020-12-30 05:25

    In Java Code:

    • UserLocalServiceUtil.getXXX methods are there, choose as you want.

    In JSP Code:

    • themeDisplay.getUserId() will give you the current user id
    • themeDisplay.getUser() will give you the object of current User.

提交回复
热议问题