You could use

Double d = Double.valueOf(stringRepresentationOfDouble);

as David suggested to read in the value correctly, then

double dbl = d.doubleValue();

to get the double value from that, or of course just:

double dbl = Double.valueOf(stringRepresentationOfDouble).doubleValue();

Alternatively, some (most?) databases would accept the value in String format so just concatenate the Double into your SQL query/update once you've verified it's format.

Simon

Kirstin Battershill wrote:

But this is my problem,   but I don't want a DOUBLE OBJECT,

I want a DOUBLE VALUE / TYPE.  I have tried the below method but then I have the problem of converting the Double d object to the value which the database will take without throwing an exception because it wants a double  whilst  I am giving it a  Double And it is this that is causing me the grieve.

I tried the Double.parseDouble,  but I just get  :  not found in java.lang.Double

Kirstin
 
 
 
 

David Mossakowski wrote:

Double d = Double.valueOf(stringRepresentationOfDouble);
or
Double d = new Double(stringRepresentationOfDouble);

(remeber to catch NumberFormatException)

dvae.

P.S. Please refer to documentation (trying to be polite but RTFM :).

Kirstin Battershill wrote:

> Hi Guys,
>
> another basic question
>
> I am taking a set double value from doGet (0.5 to be precise)
>
> and want to pass it into a double variable in doPost and then pass the
> double value into a database field which is double as well.
>
> My problem is,  this is the first time I have used a double and I have
> no idea about the request.getParameter bit.
>
> with integers you  obviously use Integer.parseInt(STRING), but I have
> tried similar combinations using doubleValue and valueOf and also
> tried declaring a new Double object and parsing that.
>
> But to no avail.
>
> Help
>
> Thanks
>
> Kirstin
>
>

--
David Mossakowski        [EMAIL PROTECTED]
http://www.dwdog.com/styk      212.310.7275

"I don't sit idly by, I'm planning a big surprise"
F         U         G         A        Z        I

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to