cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to display mapped data ...

Former Member
0 Kudos

Hello All,

I have a situation here... I am able to display a mapped context value from Component A to Component B's view controller but for some strange reason, it will not pass the data to B's component controller.

<u><b>Coding for View Controller and Component Controller</b></u>

String tempString = wdContext.nodeIntialise_Output().currentIntialise_OutputElement().getUserID();

wdComponentAPI.getMessageManager().reportSuccess("Values from TripType View : " + tempString);

However, should I placed the above code in the "wdDoPostProcessing" of Component Controller B, it works.....

Does anyone knows why and how can I get the value of the mapped context to display in the component controller of B ?

from

Kwok Wei

Accepted Solutions (1)

Accepted Solutions (1)

BeGanz
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hallo Kwok Wei,

I did not investigate your problem in detail but let me give you some further explanations which possibly help:

Do you apply <b>external context mapping</b>? In this case the mapping chain is not initially created by the Web Dynpro Runtime. This means that the context elements in externally mapped nodes are not yet accessible when the wdDoInit() hook methods are called. The Web Dynpro Java Runtime can only fill the externally mapped nodes afterwards. Why this? The wdDoInit() methods are called for initializing a controller itself independant from its environment. It is not guaranteed that the complete controller environment is already initialized too.

As a workaround I propose to <i>"out-source"</i> the context access parts from the wdDoInit()-method to a public method of the custom controller. Within the onPlugDefault()-method of the Component Interface View Controller (which is called after having initialized all envolved controllers) you can then call this public component controller method for processing some additional initializations.

The startup plug event handler of the component interface view controller can be seen as an overall-wdDoInit() method. It is the best hook() for triggering cross-controller initializations.

Regards, Bertram

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi

Where are you currently writing the print statement.

You can print it if you write the print statement in the doInit of component Controller B provided you have set the value of the context attribute with the appropriate mapping.

Well here is the sequence of execution in Webdynpro.

If you have 2 components say Comp A and Comp B

Then this is the process of execution.

1. The Component Controller of Component A is executed with a call to the doInit() method.

2. Then the doInit() of Comp A's View is called.

3. Then the Component Controller of Component B is executed with a call to the doInit() method.

4. Then the doInit() of Component B's Interface controller is executed.

5. The doInit() of Component B's View is then executed.

6. Then the onPlugDefault() of Component A is called.

7. The doBeforeNavigation() method of Component A's Component Controller is called.

8. The doBeforeNavigation() method of Component B's Component Controller is called.

9. The doModifyView of Component A is called.

10. The doModifyView of Component B is then called.

11. The doPostProcessing() method of Component A's Component Controller is called.

12. The doPostProcessing() method of Component B's Component Controller is called.

The above steps happen when the component is loaded.

Now when a action happens say "Click of a button" or something then the sequence of execution is

1. The method associated with the click gets called. Then the doBeforeNavigation() of Component A's Controller is called followed by the call doBeforeNavigation() of Component B's Controller.

2. The doModifyView() of Component A is then executed followed by doModifyView() of Component B.

3. Then the doPostProcessing() of Component A's Controller is called followed by the call doPostProcessing() of Component B's Controller.

Let me know if that helped you. Maybe the place where you have written the print statement doesnt get called. Hope that helps you.

regards

ravi

Former Member
0 Kudos

Hello Ravi,

Thank you very much for the detailed sequesnce descriptions.

This is what I am trying to do :

1) CompB is embedded into Comp A,

2) CompA is suppose to be doing some initialisation stuff and is responsible for passing the initialised values into CompB,

3) The values passed into the component controller of CompB is meant to do further processing and later have it display in the View.

4) To ensure that the data is properly mapped from CompA to CompB, I did the following call in the wdDoInit of the cmponent controller in CompB :

String tempString = wdContext.nodeIntialise_Output().currentIntialise_OutputElement().getUserID();

wdComponentAPI.getMessageManager().reportSuccess("Values from TripType View : " + tempString);

4) However, it seems that I am unable to do so (message manager returns a null) as the values , for some reason, cannot be passed and displayed in the wdDOInit of the component controller in CompB. I can however, get it to display in the <u><b>view</b></u> controller of CompB.

hence, my question is, why is it that I am not able to display the values in the component cotroller of CompB under wdDoInit ? the wdDoPostProcessing was a trial and error and I manage to call and display the values there.

from

Kwok Wei

Former Member
0 Kudos

Hi Kwok Wei,

I think if you want to pass values from comp A to comp B through map, you can:

1)In Comp A change the "web dynpro component usage lifecycle" (here is comp B usage)from createOnDemand to manual.

2)set the wdContext's nodeIntialise_Output() value.

3)create the comp B usage manually in the code.

Then Comp B will get the value from Comp A

Hope it's helpful

Best regards

Deyang

Former Member
0 Kudos

Hi kwok

The initialization stuff in CompA that you mentioned. where is it being done. i mean in which place. How have you done the mapping. Have you mapped the context attributes from the view of CompA to the Interface controller of compB or what. If you can explain these then it will be easy to determine what your problem might be. I assume that when you initialize in CompA the values are not set when compB's init method is called so it is coming as empty.

The doPostProcessing and doBeforeNavigation gets called everytime. So when you placed your message in that method it had the context filled with values at some point and was able to give you a output.

Well there is something interesting that i happen to stumble upon. When you have mapping between context attributes the sequence of execution changes

The doInit() of CompA Component Controller followed by the doInit() of CompB Component Controller and then the doInit() of CompB Interface controller gets executed.

Only after this execution it goes to the view of CompA. That is the reason you are not getting any values.

But the main point here is about how the sequence takes place. Then you will be able to tailor the program as per your requirements.

Also when you do a mapping between Component Controller of CompA to Interface controller of Comp B then there is a different sequence in the execution of the controllers.

hope that helps your particular situation. Let me also see how the value can be passed. I havent really come across this but It seems quite interesting to know how exactly the controllers behave.

regards

ravi