cancel
Showing results for 
Search instead for 
Did you mean: 

Value attribute of type date

Former Member
0 Kudos

Hi,

I need to send 1 input date to web service. I have an input field . I want to map the same to a value attrubute which is defined by me. Now when i call the web service the input value of the input field doesnt go web service and i get null pointer exception. How will i bind such extra value attribute to web services?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

How are setting the value from value attribute to the model node of webservice...

Is their any input attribute of type date ...

You cant add extra value to your model node.. Why cant u create the same in the webservice and re-create the model..

By the way what is exposed as web service here ?

Regards

Bharathwaj

Former Member
0 Kudos

Existing web service expects a date in string format. Since i wanted to use calender(datenavigator) in my UI i wanted an attribute of type date and map it to ithe input field. but when i call the web service the value desnt go...

Former Member
0 Kudos

hi,

Use

SimpleDateFormat stringdate = new SimpleDateFormat("dd-MM-yyyy'); //I remember u saying that u wanted it in this format...

stringdate.format(the date object)...

will return the date in the specified string format .......!

Regards

Bharathwaj

Former Member
0 Kudos

thats not the issue. How will i change it during my web service call. How will i change the attribute value during runtime so that string goes to web service?

Former Member
0 Kudos

You have mapped the input field to a value attribute of type date.

Get it in the code usiong its getter method.

now convert as i have mentioned and then create a object of the webservice model node.. set this string value to it and execute the model..

Where is the problem ?

Former Member
0 Kudos

Oh ok....can u pls give a sample piece of code to access the control to get the value and set it to model? I am very new to web dynpro...pls help

Former Member
0 Kudos

Hi sujesh,

What you need to do is, at the time of calling the webservice retrieve the value from the attribute which you have bound to the Date navigator. convert as explained by Bharathwaj and then get that value in string using tostring method.

Now, pass this string value in your input field of the Webservice model and then execute your model.

Let me know the status whether its working or not.

regards,

Bhavik

Former Member
0 Kudos

Re: Value attribute of type date

Posted: Jul 1, 2005 4:22 PM Reply E-mail this post

hi,

Date date = wdContext.currentContextElement().get<value attrname>();

SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy');

String strdate = formatter.format(date);

z<modelobject> modelobj = new z<modelobject>();

modelbj.set<model date attribute>(strdate);

wdContext.node<model node name>().bind(model);

then

wdCOntext.current<modelnode>element().modelObject().execute();

Regards

Bharathwaj

Former Member
0 Kudos

hi ,

If you want to change java.util.date to string format here is the sample code

Date d=new Date(2004,04,04);

SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");

String date = sdf.format(d);

wdComponentAPI.getMessageManager().reportSuccess(date);

Hope this helps you

Regards

Rohit

Answers (0)