cancel
Showing results for 
Search instead for 
Did you mean: 

IWDMessageManager

Former Member
0 Kudos

Hi Gurus,

I am beginner in webdynpro trying to implement IWDMessageManager but no success.

I have a created a Name text filed on iView and I would like to display error message bottom of this filed as warning message "Please enter the text for the name filed"

I have created a Node as KrishData , Element is : Name

Iwritten this code but it not working for me.

IWDMessageManager msg = wdComponentAPI.getMessageManager();

validateInput()

{

if(wdContext.nodeKrishData().currentKrishDataElement().getName()== null) {

msg..reportMessage("Please enter the text for the name filed");

}

any help will be rewarded, many thanks

Krishi

Accepted Solutions (0)

Answers (10)

Answers (10)

Former Member
0 Kudos

Hi,

Write the following code

IWDMessageManager msg = wdComponentAPI.getMessageManager();

validateInput()

{

if(wdContext.nodeKrishData().currentKrishDataElement().getName()== null) {

msgMgr.reportMessage(IMessageComp.ERROR, null, true);

//Here IMessageComp is your MessagePool interface. you can write IMessage and your componet name.

}

before writing the code you will have to add a message key in MessagePoll entry in your component.In the code ERROR is the message key. And select the mesage type as error and write your message "Please enter the text for the name filed" in the message text.

Regards

Suresh

former_member189631
Active Contributor
0 Kudos

Hai Krish,

U can Try This :

validateInput()

{

if(wdContext.nodeKrishData().currentKrishDataElement().getName()== null) {

<b>wdComponentAPI.getMessageManager().reportWarning(("Please enter the text for the name filed");</b>

}

Regards,

Ramganesh,

Caritor India Pvt Ltd.

Former Member
0 Kudos

Many thanks for your qquick response Lohi,

see here my code

public void wdDoInit()

{

//@@begin wdDoInit()

IWDMessageManager msgMgr = wdComponentAPI.getMessageManager();

if(wdContext.currentStudentElement()== null)

msgMgr.reportmessage("Please eneter Name/Name should not be blank");

//@@end

}

The method reportMessage string is undefined for the type IWDMessageManager when i place mouse on reportMessage becausee there showing as an error.

Many thanks lohi

Former Member
0 Kudos

Hi,

You can use msgMgr.reportWarning("TEXT");

Regards, Anilkumar

Former Member
0 Kudos

Hi,

public void wdDoInit()

{

//@@begin wdDoInit()

IWDMessageManager msgMgr = wdComponentAPI.getMessageManager();

if(wdContext.currentStudentElement()== null)

msgMgr.reportmessage("Please eneter Name/Name should not be blank");

//@@end

}

// here u can get the value from the attribute

like

try this code.

String ram="";

if(ram!=null)

ram= wdContext.currentStudentElement().get<AttributeName>();

else

msgMgr.reportException("Error",true);

Thanks,

Lohi.

Former Member
0 Kudos

Hi Friends Many thanks for your replies , i applied the code snippet which you send to me but it is showing the following error message.....

The method reportmessage string is undefined for the type IWDMessageManager

here i tried to use the reportMessage(IWDMessage, Object[],boolean);

but this is also not working, i am not sure where i am doing mistake

Krish

Former Member
0 Kudos

Hi,

Post your code once what you have done.

We have do some thing .

Thanks,

Lohi.

Former Member
0 Kudos

Hi Krish,

As per the code u posted, u r using "msg.reportMessage(IWDMessage, Object[], boolean)" method. For this method u have to pass IWDMessage not a string as u code earlier "msg.reportMessage("Please enter the name field");

U can IWDMessage message in the message pool. In ur component hierarchy u will have MessagePool right click on that and "Open Message Editor" there u can create a message using "Add message" icon. it will ask for message key, message type and text.

Pass the message key in report message method

eg: msg.reportMessage(I<Ur component name>Comp.<MESSAGEKEY>, null, true);

Instead of this i think u can use reportWarning method which will take string as an argument.

eg: msg.reportWarning("Please enter name field");

i think ur if condition is ok u can check with length() ur getName() field.

Try this

Regards,

Aparna. P

Former Member
0 Kudos

Hi,

try like this.

try{

String rama = wdContext.currentKrishDataElement().getName()

}

catch(Exception e)

{

wdComponentAPI.getMessageManager.reportException("Please Enter input Value",true);

}

This make sense.

Other wise

String rama="";

if(rama!=null)

rama = wdComponent.currentKridhnaNodeElement().getName();

else

wdComponentAPI.getMessageManager.reportException("Please Enter input Value",true);

This might helps you.

Thanks,

Lohi.

suresh_krishnamoorthy
Active Contributor
0 Kudos

Hi Reddy,

Check thread too:

Regards, Suresh KB

former_member182294
Active Contributor
0 Kudos

Hi Krish,

As per my understanding you are not able to see any message even though you didnt enter any message in the input field. Correct me if my understanding is wrong..

If your problem is not seeing any message the following is the solution:

Change your if condtion to the following...

<b>String name = wdContext.nodeKrishData().currentKrishDataElement().getName();

if(name == null || name.trim().length()>0) {

msg..reportMessage("Please enter the text for the name filed");

}</b>

Regards

Abhilash

Former Member
0 Kudos

Hi

Check The cardinality of the node is 1..1

Kind Regards

Mukesh

Former Member
0 Kudos

In this case do following

In Init() method

I<<ViewName>>.IKrishDataElement ele=wdContext.createKrishDataElement();

ele.setName("xxxxx");

wdContext.nodeKrishNode().addElement(ele);

While checking you need to

if(wdContext.currentKrishDataElement().trim.equals("")

man.reportmessage("Please eneter Name/Name should not be blank");

2nd Solution

if(wdContext.currentKrishDataElement()==null)

man.reportmessage("Please eneter Name/Name should not be blank");

Regards, Anilkumar

Former Member
0 Kudos

Hi Krishi,

Are you getting NullPointer exception ??

If so pleas emake sure that you are populating the context in init() method.

otherwise the staement "wdContext.nodeKrishData().currentKrishDataElement()." will raise nullpointer exception.

Regards, Anilkumar