Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help with javascript(cant get this to work)

Status
Not open for further replies.

chaddu1256

IS-IT--Management
Jan 13, 2003
28
0
0
US
java.text.DecimalFormat decimalFormat = new java.text.DecimalFormat("0.0000");

this is at the top of the page and the code which im trying to use this is as follows

<%
//to test for null values
String va1 = &quot;&quot;;
if (utilWrap1.getExtension8().toString().equals(&quot;0.000000&quot;)){
va1 = &quot; &quot;;
}
else{
va1 = decimalFormat.format(Double.parseDouble(utilWrap1.getExtension8()
}
%>
<td> <div align=&quot;center&quot;><font size=&quot;2&quot;><%=va1%></font></div></td>

Basically whats going on is Extension8 is pulling in a water meter reading from our oracle database. The default format for this meter reading is 0.000000 what we are trying to do is format this from 6 decimal places to 4 decimal places, but also to say that if the reading is 0 then dont show anything. Im having trouble applying formatting and the null statement to the same thing. Any help would be great. Thanx
 
looks like you're actually working with server side Java, not javascript. try FORUM695

=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); }
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top