Error while getting Portlet request
[Logo]
ICEsoft.org Forums: ICEfaces, ICEmobile, ICEpdf
[Search] Search   [Recent Topics] Recent Topics   [Groups] Home Page | www.icefaces.org  [Register] Register  [Login] Login 
Error while getting Portlet request  XML
Forum Index -> Portals & Portlets
Author Message
hemen

Joined: 24/12/2009 00:00:00
Messages: 5
Offline


I am using Icefaces 1.8.2 for the portlet development in Liferay 5.2

i want to insert user using

my code is like this

i have attached my code over here

i am getting error

java.lang.RuntimeException: Unable to get the HTTP servlet request from com.icesoft.faces.webapp.http.portlet.PortletExternalContext$4


can any body help me to get me out of this?
 Filename CreateDRS.java [Disk] Download
 Description
 Filesize 4 Kbytes
 Downloaded:  67 time(s)

hdbwcon

Joined: 14/05/2009 00:00:00
Messages: 93
Offline


You can get the actually logged in user in this way:

Code:
 PortletRequest portletRequest = (PortletRequest)context.getExternalContext().getRequest();  
 			ThemeDisplay themeDisplay = (ThemeDisplay)portletRequest.getAttribute(WebKeys.THEME_DISPLAY);
 			
 			User user=null;
 			user=themeDisplay.getUser();
 


Then you can access the id.
hemen

Joined: 24/12/2009 00:00:00
Messages: 5
Offline


Thanks for you reply.

Problem has been solved...

Code:
 PortletRequest portletRequest = (PortletRequest)context.getExternalContext().getRequest(); 
 
 ServiceContext  serviceContext = ServiceContextFactory.getInstance(CreateDRS.class.getName(), portletRequest );
 
 UserLocalServiceUtil.addUser(Long.parseLong(userID), user.getCompanyId(), false, password , confirm_password,false,
 firstName,  email, "", new Locale("en", "US"),  					firstName, "", lastName, 0, 0,  true, 1, 1, 1970, "", new long[]{10131}, 	new long[]{10502}, new long[]{10124}, new long[]{10202}, false, serviceContext);
 



the above "portletRequest" is not working with ServiceContext...
So instead of that I have just create
Code:
 
 ServiceContext  serviceContext = new ServiceContext();
 

And pass it in the UserLocalServiceUtil.addUser() and now it works fine...
 
Forum Index -> Portals & Portlets
Go to:   
Powered by JForum 2.1.7ice © JForum Team