See below:
Alan Goodenough wrote:
>
> hi,
>
> we are in the process of developing an E-Commerce store using JSP, and =
> are having difficulty getting our getXXX() methods to work. We can =
> retrieve our getPrice() method, but we cannot retrieve the others in the =
> same class. Both methods are identical in that they are floats.=20
>
> this is the JSP calling the methods (prod_code is passed from the =
> previous page)
> <%
> SWRTstore_product prod =3D new SWRTstore_product(prod_code);
>
> float price =3D prod.getPrice(); // works fine
> float weight =3D prod.getWeight(); // this doesn't work=20
> %>
>
Looks ok syntaxwise. Have you checked that the class is being reloaded
properly by the jsp engine you're using? check for caches, or the .class
file in two places on the classpath, etc. There can be some nice gotchas
with some of the servlet engines to do with class reloading (or not as
the case may be). To be sure you've really got to shut down and restart
the servlet engine (which can be a real pain in a production
environment....).
And not wanting to be critical, but speaking from personal (bitter)
experience, it is a _really_ bad idea to use floats for prices. Check
out using BigDecimal instead - that is if you ever want to consider
trading in Turkey, or Italy, etc...! Using BigDecimal also maps nicely
to using get/setBigDecimal under JDBC, and to Oracle's number(38,2) type
for currency use (among other things).
--
Jari Worsley
Senior Programmer
Hyperlink plc
===========================================================================
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