Reputation: 432
I want to capture Liferay Logged In User details in JSP (Say email-ID , name etc). I dont want to use any framework. I am new to JAVA and Liferay so any detailed step will be a great help for me to proceed. Thanks in advance.
Upvotes: 2
Views: 9036
Reputation: 1
You can also get the user information in a JSP using the following:
long uid = com.liferay.portal.util.PortalUtil.getUserId(request);
User user = UserLocalServiceUtil.getUserById(uid);
Upvotes: 0
Reputation: 7729
In any of your login jsp pages, you can get the user object of the one who logged in by calling the method:
ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(com.liferay.portal.kernel.util.WebKeys.THEME_DISPLAY);
User objUser=themeDisplay.getUser();
From this objUser, you can get all the details you need.
Upvotes: 3
Reputation: 3865
If you add to your jsp
<%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme"%>
<liferay-theme:defineObjects />
than you can just use
<%= user.getEmailAddress() %>
or if you use jstl than
${user.emailAddress}
meaning <liferay-theme:defineObjects />
has put user object in page context.
Look up com.liferay.portal.model.User
to see all properties available.
Upvotes: 4