Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
pawan chauhan
capturing user credentials
December 6, 2012 3:15 AM
Answer

pawan chauhan

Rank: Junior Member

Posts: 75

Join Date: October 8, 2012

Recent Posts

Hi all,

I am trying to capture the screen name of the user. so that i can use it further.
Is it possible,
please advice how can i do it.

Regards,
Pawan Chauhan.
Jan Geißler
RE: capturing user credentials
December 6, 2012 3:20 AM
Answer

Jan Geißler

Rank: Expert

Posts: 356

Join Date: July 5, 2011

Recent Posts

1
2        ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
3        User currentUser = themeDisplay.getUser();
4        String fullName = currentUser.getFullName();


Something like this?
Jitendra Rajput
RE: capturing user credentials
December 6, 2012 10:43 PM
Answer

Jitendra Rajput

Rank: Liferay Master

Posts: 677

Join Date: January 7, 2011

Recent Posts

For screen name

1 ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
2 User user = themeDisplay.getUser();
3String screenName = user.getScreenName();
pawan chauhan
RE: capturing user credentials
December 6, 2012 10:51 PM
Answer

pawan chauhan

Rank: Junior Member

Posts: 75

Join Date: October 8, 2012

Recent Posts

Hii Jan,

Thanks for the reply.
I guess something exactly like this.
But strangely enough when i try to use it in my scriptlet tag i have trouble with imports.

for this to work ,
1ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(com.liferay.portal.kernel.util.WebKeys.THEME_DISPLAY);       


I imported
<%@ page import="com.liferay.portal.kernel.util.WebKeys" %>


But It Just wont stop showing error..

Am i doing something wrong.
Please advise.
Regards,
Pawan Chauhan.
Jitendra Rajput
RE: capturing user credentials
December 6, 2012 10:58 PM
Answer

Jitendra Rajput

Rank: Liferay Master

Posts: 677

Join Date: January 7, 2011

Recent Posts

Use this tag lib

1<portlet:defineObjects />
2<liferay-theme:defineObjects />


And directly access themeDisplay object in your JSP

themeDisplay.getUser();
pawan chauhan
RE: capturing user credentials
December 6, 2012 10:58 PM
Answer

pawan chauhan

Rank: Junior Member

Posts: 75

Join Date: October 8, 2012

Recent Posts

Hi Jitendra,
Thanks for the reply.

Regards,
Pawan Chauhan.