[开发] 关于liferay portlet开发的userid(用户)问题

pikachu 2007-09-13
Display88 写道
request.getRemoteUser() 取出来的就是userId啊

楼上的正解!如果只用jsr168规范开发,这个足够了!
thomas0988 2007-09-17
<%@ page import="com.liferay.portal.model.*" %>
<%@ page import="com.liferay.portal.service.*" %>
<%@ page import="com.liferay.portal.kernel.util.ParamUtil" %>


<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>

<portlet:defineObjects />

<%

String screenName = ParamUtil.getString(request, "screenName");
long companyId = ParamUtil.getLong(request, "companyId");

User user = UserLocalServiceUtil.getUserByScreenName(companyId, screenName);
Organization organization = user.getOrganization();

%>

userId: <%= screenName%> <br />
name: <%= user.getFullName() %><br />
organization = <%= organization.getName()%>
Global site tag (gtag.js) - Google Analytics