cancel
Showing results for 
Search instead for 
Did you mean: 

how to convert bigdecimal to double in webdynpro java

Former Member
0 Kudos

Hi

I have label BASIC PAY and input field,for that input field i have binded amodel attribute of type bigdecimal.now that input field should not accept negative values,can u please tell me how to write acode sothat that input should accept only positive values.

Thanks

Krishna

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Krishna,

first put a validation check

try{

if{wdcontect.currentContextElement.getamodel()>0.0|| wdcontect.currentContextElement.getamodel()=0.0)

{

-


-


}

}

catch(Exception e)

{

wdComponentAPI.getMessageManager().reportSuccess("Please enter positive values");

}

Regards

Khushboo

Former Member
0 Kudos

Hi Krishna,

Create one value attribute and bind that to a simple type(double) dictionary , in that dictionary give ur min value as 0 and max as per reqd.

if any doubt let me know.

Thanks & Regards

Manoj Sahoo

former_member191569
Active Participant
0 Kudos

The attribute is "decimal", a built-in type in WebDynpro that translates to Java BigDecimal type. If you do not want to allow a negative value to enter in the InputField you can code a validation function when you submit the data to the server.

Former Member
0 Kudos

>

> how to convert bigdecimal to double in webdynpro java

Hi,

Try this:

double x = wdContext.currentContextElement().getBigdecimalAttribute().doubleValue();

Refer methods applicable on Bigdecimal here -

http://code.google.com/android/reference/java/math/BigDecimal.html

Regards,

Anagha

Edited by: Anagha Jawalekar on Nov 17, 2008 12:08 PM