hi,
i do have a float field in a database. then i display it in my jsp file.
for a value that is 0.56174 in the database, the display result in the jsp is : 0.5617400000000000
for a value that is 0.5213 in the database, the display result in the jsp is : 0.52129999999999999
and for a value that is 5.47620370956691E-03 in the database, the display result in the jsp is : 5.4762037095669111E-3
as you can see, it's each time different.
HERE are the different steps i make to display this value under my jsp, so you will maybe find the moment where i don't do the right thing :
First i do have a String (called here myString) where i put this value :
Then i need to test this :
Then i forward the object to the jsp this way :
Finally i display the result in my jsp this way :
here is a small solution that could maybe works : if i use a primitive float, then i put the database value with rs.getFloat in stead of rs.getString, then ??? then i must test if the float is null/empty. and here i am blocked, i don't know how i could test it. and i don't even know if this would change my display problem in my jsp.
any idea ?
Best regards X-),
Elise
i do have a float field in a database. then i display it in my jsp file.
for a value that is 0.56174 in the database, the display result in the jsp is : 0.5617400000000000
for a value that is 0.5213 in the database, the display result in the jsp is : 0.52129999999999999
and for a value that is 5.47620370956691E-03 in the database, the display result in the jsp is : 5.4762037095669111E-3
as you can see, it's each time different.
HERE are the different steps i make to display this value under my jsp, so you will maybe find the moment where i don't do the right thing :
First i do have a String (called here myString) where i put this value :
Code:
myObj.myString = rs.getString("RAT_EOLY");
Code:
if (myObj.myString.equals(""))
Code:
request.setAttribute("searchResult",myObj);
RequestDispatcher dispatcher = getServletContext ().getRequestDispatcher("/myJSP.jsp");
Code:
ResponseObj rObj =(ResponseObj)request.getAttribute("searchResult"); // gets the response object of the query
<% if(rObj != null) { %> // to display it
<% if(rObj.myString!= null) { %>
<%= rObj.myString.toString() %>
<% }} %>">
here is a small solution that could maybe works : if i use a primitive float, then i put the database value with rs.getFloat in stead of rs.getString, then ??? then i must test if the float is null/empty. and here i am blocked, i don't know how i could test it. and i don't even know if this would change my display problem in my jsp.
any idea ?
Best regards X-),
Elise