0

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.

Community
  • 1
  • 1
Wandang
  • 912
  • 2
  • 8
  • 37

1 Answers1

1

On JSP, extract your parameter from implicit request object. Like:

<%
String userId = (String) request.getAttribute("myUser");
%>
Parkash Kumar
  • 4,710
  • 3
  • 23
  • 39
  • this worked. i did not use `request` because it could not be resolved into a variable before. Now it just works fine. thanks – Wandang Nov 11 '13 at 15:02