Jump to content

Object to Double in Jsp

- - - - -

  • Please log in to reply
2 replies to this topic

#1
toto_7

toto_7

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 295 posts
Hello,

Anyone knows how you do that in jsp? tried parseDouble and valueOf() but nothing

Edited by toto_7, 06 May 2011 - 03:12 PM.


#2
wim DC

wim DC

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,084 posts
  • Programming Language:Java, JavaScript, PL/SQL
  • Learning:Java
Dependant on whether the object was a double first or not, you should just cast it:

Object object1 = new Double(9.1);

double d = (Double) object1;  //Watch the capitalisation here

This works fine.
If the object was a String, you first need to cast it to a String and then do parseDouble

Object object1 = "9.1";

String s = (String) object1;  

double d = Double.parseDouble(s);



#3
toto_7

toto_7

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 295 posts
Thank you, thats helped :)




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users