cancel
Showing results for 
Search instead for 
Did you mean: 

IWDMessage text

former_member191569
Active Participant
0 Kudos

Hello!!

I have some messages in my WebDynpro component Message Pool.

I am using the following instruction:

IWDMessage m = IMessage<CompName>.MESSAGE; // MESSAGE is the key of an error message

WDMessage message = (WDMessage) m;

Then, when I try to retrieve the message's text via message.getMessageText() the result is null.

How can I get the text?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Try this:

String messageText = wdComponentAPI.getTextAccessor().getText("Message_Key");

Hope this helps!

Regards,

Jaya.

Former Member
0 Kudos

Correct.

Slightly better:


String localizedText = wdComponentAPI.getTextAccessor().getText(IMessage<CompName>.MESSAGE);

Armin

former_member191569
Active Participant
0 Kudos

Thank you for your answers.

Well, actually I am using Armin's method to retrieve message's text, but far from this practical issue I am still confused about this topic.

It is strange for me that IWDMessage class has no getter methods. Also, Chris Whealy in his "Inside Web Dynpro fro Java" uses the mapping IWDMessage to WDMessage to get the message text without using IWDTextAccessor class.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi David,

Use the following Code:

IWDMessageManager msg = wdThis.wdGetAPI().getComponent().getMessageManager();

msg.reportMessage(IMessage<Component Name>.<MESSAGE_KEY>, new Object[]{},true);

I hope this solves your issue, if you are looking for something else, please revert. I'll be happy to help you.

Cheers!!!

Umang

Former Member
0 Kudos

Hi Umang,

I have some queries regarding the error messages in WDJ. For standard wdComponentAPI.getMessageManager messages, the error message automatically drops the last word (making it a 2 line error message) if there are multiple errors (kindly refer to the image below). Can we make it so that it would appear only in one line? I need this to be displayed in one line only, maximizing the space. I’ve tried to set the width for RootContainer and MessageArea to 100% but to no avail. Hope you can help me out on this one. Thanks!



Cheers,

Marj