on 12-10-2007 3:37 PM
Dear All!
How can I define with WebDynproin a class a boolean variable
assign a value e.g false.
boolean appeared = false;
And later in another class it will be aasigned to the
value "true" if a coditions is fullfilled.
Please notice both classes are in the same
Development Component
if(.....)
{
appeared = true;
}
regards
sas
Hi Sas,
The best way is to define the boolean variable as context attribute in the classes wherever you want and finally in Component Controller and map them all. Then the varable becomes global to DC. You can set this in your class using
wdContext.currentContextElement().setAppeared(true);
or else if you want to define only class variable,
you must define it in block
//@@begin others
//@@end
But this usage is not much recommneded by SAP. The scope of the varable is only this view is visible.
regards,
Siva
Message was edited by:
Siva Rama Krushna
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear All!
To clearify misunderstandings.
Suppose there might be a variable (boolean).
This variable is in the controller class. And now I would like
access this variable from the view class.
bye
sas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Ideally you can acheive this using context attributes.
IF you still want to work with classes
1)Create a class , specify a constuctor and set and get method for the property.
2)In the init of the controller create an instance of this class
3)Create a method in the controller which returns the instance of this class.
Next
1) Create a singleton class
2)Access it from two different places.
Regards
Ayyapparaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok but how can I access to this variable from out of the other class.
Imagine there are classes:
Class1
has
boolean appeared = false;
Class2
?????getAppeared();
sas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sas,
In Web Dynpro class to class data transfer is only possible through context mapping.
If a variable is defined in
//@@begin others
//@@end you need to use the context varable to pass the value of this varable.
Taht's why use context variable
If you want to pass the variable to another view. Do This.
In View1 create a context attribute appeared of type boolean.
<b>copy</b> this, go to context tab of View2 and Component Controller <b>paste</b> this. Now in View1 context tab ,select this right click select editContextmapping,
you can map to Controller, do same for View2 also.
if you want to set this attribute,
use this code
wdContext.currentContextElement().setAppeared(false);
if you want to get this attribute.use this code
wdContext.currentContextElement().getAppeared();
if this does not serve your requirement,just give you exact requirement.
Siva
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.