Reputation: 952
I am trying to get the UUID from a user.
So far i tried
Accessing the user from a liferay portlet?
Get the current user Liferay using a simple Java code
putting String userId = renderRequest.getRemoteUser()
into the view.jsp worked to get the intern ID.
However i wanted the UUID instead.
If i use the code from the links above (into the java-class doView) i only get a null-user object.
Using getUserUuid() and getUuid() returns null.
Here is my class:
ThemeDisplay td =(ThemeDisplay)renderRequest.getAttribute(WebKeys.THEME_DISPLAY);
User user = td.getUser();
String userId = user.getUuid();
renderRequest.setAttribute("myUser", userId);
and my view.jsp
<%
String userId = (String) renderRequest.getAttribute("myUser");
%>
<%= userId %>
Any help is appreciated.
Upvotes: 0
Views: 1936
Reputation: 4730
On JSP, extract your parameter from implicit request object. Like:
<%
String userId = (String) request.getAttribute("myUser");
%>
Upvotes: 1