-2

i am dividing the number & want output only with one decimal like 4.1 or 4.2

"SELECT  count(*)/6 as s from t1 ";   

<td class = "inp"><% out.print(rs.getDouble("s")); %></td>

Please help, I am new to jsp

Krzysztof Krasoń
  • 26,515
  • 16
  • 89
  • 115
Arjun
  • 9
  • 5

1 Answers1

0

use String.format and %.1f format (1 digit after decimal point):

<td class = "inp"><% out.print(String.format("%.1f", rs.getDouble("s")))); %></td>
Krzysztof Krasoń
  • 26,515
  • 16
  • 89
  • 115