Hey guys ... thanks for the tips... i try using Float.parseFloat before but
i keep getting this error:

D:
\WebSphere\AppServer\hosts\default_host\b2bshell\html\pagecompile\_ecatalog\_Buyer\_CS__ViewPOCHolder_xjsp.java:185:

Incompatible type for declaration. Explicit cast needed to convert double
to float. float SumTotalValue = 0.0 ; ^ D:
\WebSphere\AppServer\hosts\default_host\b2bshell\html\pagecompile\_ecatalog\_Buyer\_CS__ViewPOCHolder_xjsp.java:232:

Method parseFloat(java.lang.String) not found in class java.lang.Float.
float TotalValue = Float.parseFloat(bnViewPOCHolder.getNet_Total(i)); ^ 2
errors

Please help! :)




                    Matt Krevs
                    <mattkrevs@BIGPON        To:     [EMAIL PROTECTED]
                    D.COM>                   cc:
                    Sent by: A               Subject:     Re: Float problem in JSP
                    mailing list
                    about Java Server
                    Pages
                    specification and
                    reference
                    <JSP-INTEREST@jav
                    a.sun.com>


                    04/12/00 01:12 PM
                    Please respond to
                    A mailing list
                    about Java Server
                    Pages
                    specification and
                    reference





check the archives

There was a fairly detailed discussion re: the limitations of floating
point
arithmetic last week

-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of Khoo Swee Chin
Sent: Wednesday, 12 April 2000 13:25
To: [EMAIL PROTECTED]
Subject: Float problem in JSP


Hi there,

can somebody help me out with the float problem i'm having. I am new with
JSP.
i try to convert a string to a float to do a calculation in jsp, but the
results turn out to be not what i expected, here are my code:
....
<% float SumTotalValue = 0 ;%>

<repeat index = i>
<%bnViewPOCHolder.getPO_No(i);%>

       <% float TotalValue = new
Float(bnViewPOCHolder.getNet_Total(i)).floatValue();%>
                 <% SumTotalValue = SumTotalValue + TotalValue ;%>
</repeat>
<%=a.format(SumTotalValue)%>
........

Sometimes i get a float number like 522.061 instead of 522.06 and sometimes
it's ok.
What should i do? How can i set the decimal places to 2?

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to