on 2008 May 20 7:25 AM
Hi,
i new to WebDynpro,
i do the exercise 3 from Ja312 and in the Book i have to Add
this code Below:
the problem is that i have redlines in getCmp_firstname
and in wd.Context how can i solve it?
Regards
For resolving the issue of getCmp_firstname , i go to the component controller "Exc_IntroController" and select the context tab. There in the left Window i have context ->firstname ->lastname
public void onPlugFromStartView(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onPlugFromStartView(ServerEvent)
String firstname =
wdThis.wdGetExc_IntroController().wdGetContext().
currentContextElement().getCmp_firstname();
String lastname =
wdThis.wdGetExc_IntroController().wdGetContext().
currentContextElement().getCmp_lastname();
if ( ( firstname!=null ) & (lastname!=null)){
response = "hellow , "+firstname+" " +lastname ;
}else {
response = "Hellow, stranger";
}
wd.Context.currentContextElemnt().set_txtviewresult(response);
//@@end
}
wdThis.wdGetExc_IntroController().wdGetContext().
currentContextElement().getCmp_firstname();
this will access Cmp_firstname attribute in the component Exc_Intro controller where you named it as firstname and lastname
either change your code as
wdThis.wdGetExc_IntroController().wdGetContext().
currentContextElement().getFirstname();
or rename the component context attribute as cmp_firstname instead firstname
replace wd.Context with wdContext
nikhiL
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bos,
Thanks For your Replay!
when i do ctrl+space i get 3 metods of set how i now
which of them i can use?
1 .setAttributeValue()
2. setFirstname()
3. setLastname()
i assuming that i have to use setAttributeValue() but when
i enter this code : setAttributeValue(response) i still have red line under.
Regards
see, set_txtviewResult(response) gives error since there is no context attribute with _txtviewResult.
1 .setAttributeValue() // common method to set values
2. setFirstname() // set firstname
3. setLastname() // set lastname
When you create new attribute in context, appropriate methods have been generated.
Hope you understand
nikhiL
Hi ,
i have :FirstName LastName
if u have the book JA312in exercise 2 there is no place that it
write to add txtviewResult aand bind it to something.
but in the code the add this lines :
vwdContext.currentContextElement().setCtx_txtviewResult(response) ;
i new with this so its little confused .
Regards
Hi,
Yes a value attribute
Write the following code in the event handler of a button(for test purpose)
String response;
if ( ( firstname!=null ) & (lastname!=null))
{
response = "hellow , "firstname" " +lastname ;
}else {
response = "Hellow, stranger";
}
wdContext.currentContextElemnt().set_txtviewresult(response);
Regards
Ayyapparaj
Hi,
if you realy have context ->firstname ->lastname in the CMP Context you should be access it with this code:
String lastname = wdThis.wdGetExc_IntroController().wdGetContext().currentContextElement().getLastname();
without the Cmp_
The wd.Context part should be wdContext without .
i hope this will help you
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ricardo,
It should be wdContext instead of wd.Context and please check in Component Controller "Exc_IntroController" whether Cmp_firstname context exists or not?
Regards,
Vaibhav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
68 | |
8 | |
8 | |
7 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.