You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Anto Paul <an...@uniware.net> on 2004/01/22 13:05:52 UTC
[Beanutils] Problem with RowSetDynaClass when field have 3 decimal part.
Hi,
I am using RowSetDynaClass to carry data to JSP. If the field is a
number field and it have 3 digits after decimal it is printing 4 digits the
last one being 0. For eg. instead of printing 1.256 it will print 1.2560.
Please suggest a way so that it won't affect other datatypes this is because
I am using a custom tag to print values in all pages. I am doing this.
ResultSet rs = pstmt.executeQuery();
RowSetDynaClass rsdc = new RowSetDynaClass(rs);
List list = rsdc.getRows();
In JSP
DynaBean data = (DynaBean)list.get(0);
out.print(data.get("weight"));
Here 1.56 prints Ok while 1.562 prints as 1.5620.
This is with JDK 1.4.1, Oracle 8.1.7. The field type is number(13,3).
Hope this information is enough.
rgds
Antony Paul
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
Re: [Beanutils] Problem with RowSetDynaClass when field have 3 decimal part.
Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
hi
as i said, i strongly suspect that this is principally a JDBC
driver/database issue. the solution i'd recommend is custom formatting
in the presentation layer. in the custom tag, i'd suggest checking for
values of type Float and then using a formatter than supresses the
extra zeros.
- robert
On 22 Jan 2004, at 12:05, Anto Paul wrote:
> Hi,
> I am using RowSetDynaClass to carry data to JSP. If the field is a
> number field and it have 3 digits after decimal it is printing 4
> digits the
> last one being 0. For eg. instead of printing 1.256 it will print
> 1.2560.
> Please suggest a way so that it won't affect other datatypes this is
> because
> I am using a custom tag to print values in all pages. I am doing this.
>
> ResultSet rs = pstmt.executeQuery();
> RowSetDynaClass rsdc = new RowSetDynaClass(rs);
> List list = rsdc.getRows();
>
> In JSP
>
> DynaBean data = (DynaBean)list.get(0);
> out.print(data.get("weight"));
>
> Here 1.56 prints Ok while 1.562 prints as 1.5620.
>
> This is with JDK 1.4.1, Oracle 8.1.7. The field type is number(13,3).
>
> Hope this information is enough.
> rgds
> Antony Paul
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org