on 11-29-2007 6:28 PM
Hi All,
I need to get an attribute from my WebDynpro Project.
I set this attribute into a JSP page, with the instruction "session.setAttribute("mysessvar", "TEST");".
Now, how can I get this attribute from my WebDnpro?
Thanks.
Regard,
Matteo
Hi Satyajit,
I have included your code in my WebDynpro, but I have this error:
"ScopeType.CLIENTWINDOW_SCOPE cannot be resolved".
In fact, I have three values: COMPONENT_SCOPE, NO_SCOPE, SERVERSESSION_AT_LEAST_ONE_APP_SCOPE.
If I choose one value, I have another error: "cannot convert from IMaintainScope to IScope".
I tried the cast, but I don't retrieve the value of my session attribute, because it go in the catch:
try {
IScope scope = (IScope)Utils.getScopeMaintainer(ScopeType.COMPONENT_SCOPE);
if(scope.containsKey("mysessvar")){
Object value = scope.get("mysessvar");
wdContext.currentContextElement().setMyVar(value.toString());
}
} catch (Exception e) {
// TODO: handle exception
}
Thanks,
regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Satyajit,
I have Netweaver ver. 2.0.17, the object WDScopeUtil cannot be resolved.
Regards,
Matteo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Ok this is taboo and I am not supposed to give you this code piece (it will be deleted if the Moderators find out). Try this:
IScope scope = Utils.getScopeMaintainer(ScopeType.CLIENTWINDOW_SCOPE);
if(scope.containsKey("<param_key>")){
Object value = scope.get("<param_key>");
}
Do understand that this makes use of internal WD classes and is not supported in later releases of WD. I'm telling you this because you are on one of the earlier versions.
Regards,
Satyajit.
Hi Venkat,
I have solved the previous error ("WebContextAdapter cannot be resolved"), but my variable is a session attribute, not a request parameter. I need necessarily to retrieve a session attribute.
Thanks.
Regards,
Matteo.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Venkat,
I have an error: "WebContextAdapter cannot be resolved" (after I chose Source->Organize Import).
Thanks.
Regards,
Matteo.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
IWDWebContextAdapter webContext = WebContextAdapter.getWebContextAdapter();
String param = webContext.getRequestParameter("mysessvar");
Regards,
Venkat.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
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.