on 10-15-2008 3:00 AM
Dear All,
I want use a variable between 2 methods.but don't know how to do , There are my part Error code ,
public class TestHtml
{
public String mystr1 = "";
public void wdDoInit()
{
mystr1 = "0123";
}
public void onActionExportIE(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
String mystr2 = mystr1 + "b";
}
}
when I click save button ,
"public String mystr1 = ""; disappear .
can you help me ?
thanks!
Hi Doke,
The best way to declare public/private variable is to declare it on global area
Declare it at the end of view where you can see this begin and end part
Inside (As shown below) it will treated as golobal variable, which can reuseable
Anywhere within your iview.
//@@begin others
public String mystr1 = "";
//@@end
It will solve your problem.
Thanks
Anup
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Create a context attribute lets say of type String named "Mystr"
int the wdDoinit method populate this context attribute with the default value.
wdContext.currentContextElement().setMystr("0123");
access this attribute from your methods.
String val = wdContext.currentContextElement().getMystr();
Regards
Ayyapparaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can achieve this by declaring the line code -
String mystr1 = ""; in global section.
check out for the below mentioned section in your code and insert the declaration in it.
//@@begin others
//@@end
regards,
amit bagati
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
If you want to declare variable declared it in global area
Regards
Ruturaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
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.