我已经编写了以下代码,但它始终返回用户ID(数字如' 40156',' 20147' e.t.c)只有用户名
有人可以告诉我如何获取屏幕名称
ThemeDisplay themeDisplay;
HttpServletRequest httpRequest;
themeDisplay = (ThemeDisplay) httpRequest.getAttribute(WebKeys.THEME_DISPLAY);
User user = null;
long userId1 = themeDisplay.getUserId();
user = UserLocalServiceUtil.getUserById(userId1);
String screenname1 = user.getScreenName();
答案 0 :(得分:1)
我在java类中使用了以下代码,我现在可以使用下面的代码获取屏幕名称
现在"用户"对象在变量_originalScreenName
中具有屏幕名称 HttpServletRequest request;
long companyID = PortalUtil.getCompanyId(request);
User user = UserLocalServiceUtil.getUserByEmailAddress(companyID, EmailID);