on 03-02-2007 9:04 AM
Hi experts ,
I created a WebDynpro application as code example
"<b>Code to Capture Portal User ID in a Web Dynpro Application</b>" on SDN .
I add a fuction to iview of my application , the code as follow :
public void GetLogonID( )
{
Try
{
// get the currently logged in user
IWDClientUser wdUser = WDClientUser.getCurrentUser();
//get the com.sap.security.api.Iuser; It is null in case wdUser represents an anonymous user
IUser user = wdUser.getSAPUser();
//check whether the user is anonymous
if (user != null)
{
//access logon ID by iterating through the IUserAccount array
IUserAccount[] acct = user.getUserAccounts();
if(acct[0] != null)
{
String strUserid = acct[0].getLogonUid();
//pass the value obtained from the portal to value attribute
wdContext.currentNode().setAttribute(new String(strUserid));
}
}
}
}
There are 3 error information as follow :
<b>IWDClientUser cannot be resolved or is not a type .
WDClientUser cannot be resolved
The method currentNode() is undefined for the type IPrivateGetPortalUserView.IContextNode</b>
I had add com.sap.security.api.jar to variable,as follow:
Choose Java build path -> Libraries -> Add Variable -> Select variable WD_RUNTIME -> Extend -> com.sap.security -> lib -> com.sap.security.api.jar.
And I can't save the change.
I am new of Web Dynpro development.
<b>How to correct the error and make the project executable ?</b>Thank you !
Best Regards,
Jianguo Chen
<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a770132b-0901-0010-5a88-b228ccc7b7b6">Code to Capture Portal User ID in a Web Dynpro Application</a>
Press CTRL-Shift-O (Organize imports) to add all needed import statements. Then the errors about missing IWD and WD imports should disappear.
About the third message: wdContext.currentNode() makes no sense to me, should be something like wdContext.current<name-of-some-node>Element().
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hai,
Create a library project add your jars to server/provider.xml
create sda and deploy it. Add jar reference from this library. add library refernce as
Valery said.
regards,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jianguo Chen,
You have to add the <b>security.api</b> jar file to your proejct inorder resolve your problem.
Right click on your project -> properties->Java Build Path-> Add external Jars -> now select the security.apt jar file and add it.
If you are working eith DC refer to the following thread.
Regards,
Jhansi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.