cancel
Showing results for 
Search instead for 
Did you mean: 

Multiline error message in Web Dynpro for Java

former_member193726
Active Participant
0 Kudos

Hi All,

Is there a way to print a multi-line error message using IWDMessageManager API in WebDynpro for Java?

It always prints in a single line even though the message pool is saved with multi-line entries.

I dont want multiple error message icons to be displayed for each line.

It should be one error icon with multiple lines of messages.

Any help is truely aprciated. Thanks!

Accepted Solutions (0)

Answers (7)

Answers (7)

Former Member
0 Kudos

Hi Rekha,

I have already checked, and if you wish can can check it too, but the newline character "\n" would just not work even if it is in the Message Pool and is called from there.

Regards,

Tushar SInha,

Infosys Technologies,

Hyderabad

siarhei_pisarenka3
Active Contributor
0 Kudos

Hi Rekha

Have you tried to insert '\n' character into the message in the message pool?

BR, Siarhei

Former Member
0 Kudos

Hi,

I'd suggest you create a new DC to consume the messages the way you want. I think it's the best choice in your situation.

Regards,

Daniel

former_member193726
Active Participant
0 Kudos

Saleem, your suggestion might work for a pop-up or a table, but not for an error message using IWDMessageManager.

I already tried it as well. Any other suggestions?

Regards,

Rekha Malavathu

Former Member
0 Kudos

Hi,

I had same requirement which looks like your requirement...

Let me explain you my case...

I have three values in an attribute of a node, say "Yes","No","Not Known". I have to show this values in a single table cell like

-


Yes

No

Not Known

-


I have done this taking a StringBuffer

Lets say this values "Yes","No",:Not Known" are coming in a value attribute "Name" of node called Sourcenode.

StringBuffer objStrBuf = new StringBuffer();

IPrivate<ViewName>.ITargetNodeElement objNodele = null;

for(int iCount=0;iCount<wdContext.nodeSourcenode ().size();iCount++)

{

objStrBuf .append(wdContext.nodeSourcenode().getnodeSourcenodeElementAt(iCount).getName());

objStrBuf.append("\n");

}

objNodele = wdContext.createTargetNodeElement();

objNodele.setName(objStrBuf.toString());

In your case just populate your error message in a string buffer object say objStrBuf and write the code like this and try

wdComponentAPI.getMessageManager().reportException(objStrBuf.toString(),true);

I have given you a simple example, check by any chance it will suite your requirement...

Regards,

Saleem

former_member193726
Active Participant
0 Kudos

Hi Aishwarya,

I have already tried that option but unable to print data in a multi-line way.

For E.g. I want to print the data below in the same format.

-


This is not the a valid entry

(1) Check the serial # at the back of your system

(2) You may trace the serial # in your invoice.

-


But when I use it with IWDMessageManager, the data becomes

This is not the a valid entry (1) Check the serial # at the back of your system (2) You may trace the serial # in your invoice.

I want this error message to be displayed in the 3 lined fashion. Hope you got it now!

Regards,

Rekha Malavathu

Former Member
0 Kudos

Hello,

I also had a similar requirement some time back, I didnt find an alternative solution. However in order to come close to the requirement I display the first line using reportException of IWDMessageManager class and the rest of the messages I displayed in seperate lines using a textview ui element. It served my purpose. Hope it help you too

Good Luck!!!

GLM

former_member197348
Active Contributor
0 Kudos

Hi Rekha,

Unfortunately the new-line character is not working in WD message.The new-line character is working fine for TextView. But if you fill the line with spaces then you can achieve the solution. May be it is not the solution that satisfies the developer. But it definitely is a workaround. I am also looking for better solution.

E.g. To print the text you given in multiple lines use the following code. (Fill the spaces till you get the next line )

wdComponentAPI.getMessageManager().reportWarning("This is not the a valid entry" +
"                                                                                " +
	"(1) Check the serial # at the back of your system" +
"                                                                                " +
	"(2) You may trace the serial # in your invoice.");	

Regards,

Siva

Former Member
0 Kudos

Hi Rekha,

I think using combination of IWDMessageManager and Text View/Table should be the best combination to display error messages in your case as the newline just wont work in the Message Manager.

Insert a Message Manager and a text view UI Elements into the view just one below the other.

Let the first line be displayed using IWDMessageManager.

wdComponentAPI.getMessageManager().reportException("This is not the a valid entry", true);

Create a context node Vn_Mesg and Va_Mesg as its context attribute.

Create as many elements of this node as many messages to be displayed in different lines and set the messages as string in these elements correspondingly.

Display other messages using the newline argument in a Text View. Bind the Text View with the context attribute Va_DisplayErrorMessage under the root node and use String buffer to take the different elements of the Va_Mesg node and append all the error messages together, but displaying in different lines using newline notation "\n".

StringBuffer mesg= new StringBuffer();

for(int iCount=0;iCount<wdContext.nodeVn_Mesg ().size();iCount++)

{

mesg.append( "(" + iCount + ") " );

mesg.append(wdContext.nodeVn_Mesg().getnodeMesgElementAt(iCount).getVa_Mesg());

mesg.append("\n");

}

wdContext.currentContextElement().setVa_DisplayErrorMessage(mesg.toString());

Regards,

Tushar Sinha,

Infosys Technologies,

Hyderabad

Former Member
0 Kudos

Hi Rekha,

Did you try using the method reportException() of the IWDMessageManager interface? It kind of works like print stack trace in java. In your catch block you can use the exception parameter to be passed to this method