on 09-04-2007 1:51 PM
Hi,
I would like to use web dynpro for some forms with real big numbers.
So I chose decimal als type for my attribute. The underlying java type seems to be bigdecimal which can be of arbitrary length.
But it seems web dynpro cuts off the numbers in the input field after about 18 diggits. (even if I use a simple type and set the diggits to 50 for example).
Did I discover a bug? How do you handle long numbers? The only solution I can think about is using a string input field which means alot more work.
thx
Tom
Hi Thomas,
Thats not the problem with WebDynpro. All basic primitive data types supports values to some extent only. But in java we have additional classess which supports big number, only problem here is we cannot map custom object value directly to the UI element value property. But we have work around which is very simple.
- Create two value attributes named BigStringValue (of type String), BigDecimalValue(of type java.math.BigDecimal).
- Set the caliculated value property of BigStringValue to <b>true</b>. setter and getter methods will be generated.
- Assign InputField value property to BigStringValue.
Add the following code to setter and getter method.
public void setBigStringValue(IPrivateSecondView.IContextElement element, java.lang.String value)
{
//@@begin setBigStringValue(IPrivateSecondView.IContextElement, java.lang.String)
try
{
if(value != null && value.trim().length()>0)
{
BigDecimal bigDec = new BigDecimal(value);
element.setBigDecimalValue(bigDec);
}
}
catch(NumberFormatException nfe)
{
IWDAttributeInfo atribInfo = wdContext.getNodeInfo().getAttribute("BigStringValue");
wdComponentAPI.getMessageManager().reportInvalidContextAttributeException(wdContext.currentContextElement(),atribInfo,"Invalid value",false);
}
//@@end
}
public java.lang.String getBigStringValue(IPrivateSecondView.IContextElement element)
{
//@@begin getBigStringValue(IPrivateSecondView.IContextElement)
return wdContext.currentContextElement().getBigDecimalValue()==null?"":wdContext.currentContextElement().getBigDecimalValue().toString();
//@@end
}
All validations and everthing is done.
Regards
Abhilash
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If that's really the case, open an OSS message (BC-WD-JAV-RUN).
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.