cancel
Showing results for 
Search instead for 
Did you mean: 

How to read messages in message pool from a java file

Former Member
0 Kudos

Hi All,

I want to read a message that is defined in a message pool of a webdynpro component.

This reading should be done from a java file present in the "src" folder.

How can I get the handle to the IWDComponent?

Or is there any other way?

Or is there any way of reading localized messages in a java file of a webdynpro component?

Can you kindly guide me out of this issue?

Thanks and regards

RB

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hello,

my approach is more simple: how can I read within component A the message pool of another webdynpro component B ? Component A has a usage relation to component B .

I tried this within component A:

<b>this.wdThis.wdGetBInterface().wdGetAPI().getComponent().getTextAccessor().getText("ANY_TEXT");</b>

I got the exeption:

<b>java.lang.UnsupportedOperationException: Embedded Components are black boxes. You should not access parts which are not in their interface</b>.

Is there any way to share message pools ?

Thanks

Kerstin

Former Member
0 Kudos

Hello,

I am also facing the similar problem. If anyone of you have found out the solution for this, how to read the message pool of another component form one component, please share

Thanks

Rishi Gupta

Former Member
0 Kudos

Hi,

If your java file exists in the src of the Webdynpro project. Just pass the wdComponentAPI to the constructor of the class during the creation of the object.

I guess the class will be instantiated from the controller of the WD app.

Regards

Ayyapparaj

Former Member
0 Kudos

From within a controller, you get the component reference using the generated variable "wdComponentAPI" (which is a shortcut for wdThis.wdGetAPI().getComponent()).

Then you can get the text accessor interface:

IWDTextAccessor texts = wdComponentAPI.getTextAccessor();

[advertising]

Chris Whealy, "Inside Web Dynpro for Java", chapter 7.8

[/advertising]

Armin

Former Member
0 Kudos

Seems like a good book Armin

Former Member
0 Kudos

Hi All,

Thanks for looking at my query and trying to help me.

Inside a normal java file,

how can I get wdThis?

@Anil - Its not reading from a WD view/WD controller, but from a plain java file which is a part of a "DC" present in the src folder.

I hope the question is clear?

Thanks and regards

Radha Krishna .B

Former Member
0 Kudos

In which phase of the Web Dynpro phase model is this code executed? Who calls this code?

Armin

Former Member
0 Kudos

There is one more WD component which calls my code.

I didn't understand what did you mean by phase?

Thanks and regards

RB

Former Member
0 Kudos

For a description of the Web Dynpro phase model, see "Inside Web Dynpro for Java", chapter 11.

Some of the phases are e.g. validation, event handling, navigation, rendering.

If your code is called from an event handler or method of the component that contains the text accessor, you could pass the IWDTextAccessor reference as a parameter.

Armin

Former Member
0 Kudos