on 10-17-2014 6:49 PM
Am using below code to get the user details;
public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)
{
response.write("Hello world");
IUserFactory userFactory= UMFactory.getUserFactory();
response.write("Hello world 1 ");
IUser myUser = userFactory.getUser(request.getUser().getLogonUid());
response.write("Hello world 2");
response.write(myUser.toString());
response.write("Hello world 3");
}
Its print only "hello world" and "hello world1".
pls suggest how to dispaly current user logged in details.
Thanks
Hi,
If hello world 2 isnt appearing that means your code is failing with an Exception before that line..
You can just debug and see the error.
In any case you can try the following:
String userid = request.getUser().getUniqueID();
String useName= request.getUser().getUniqueName();
BR,
Tal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Anurag,
I thought IPortalComponentRequest request here you are getting problem. because that
IUser myUser = userFactory.getUser(request.getUser().getLogonUid()); is not executed.
please print what information is coming from the resuest.
Below code its working fine...
try
{
wdComponentAPI.getMessageManager().reportSuccess("Hello World");
IUserFactory userFactory= UMFactory.getUserFactory();
wdComponentAPI.getMessageManager().reportSuccess("Hello world 1 "+userFactory);
ISearchResult result = userFactory.getUniqueIDs();
IUser myUser=null;
while (result.hasNext()) {
String uniqueid = result.next().toString();
myUser= userFactory.getUser(uniqueid);
String userid = myUser .getUniqueName();
}
wdComponentAPI.getMessageManager().reportSuccess("Hello world 2");
wdComponentAPI.getMessageManager().reportSuccess(myUser.toString());
wdComponentAPI.getMessageManager().reportSuccess("Hello world 3");
}catch(UMException ex)
{
}
Regards
Vijay Kalluri
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.