Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Get Double data type through a getParameter()  RSS feed

 
kierk kabitz
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone:

Could someone help me how to get a double data type in order to display in the view through a servlet:


objReferencias.setImprevistos(request.("imprevistos"));

Question:
request.getDouble("imprevistos));? or
request.getDoubleParameter("imprevistos));?

I've been searching but I have not found the appropriate answer.

Thanks for you help

Kierk
 
Stefan Evans
Bartender
Posts: 1834
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Request parameters are always Strings.

request.getParameter() returns a String.
Double.valueOf( stringValue ) would convert it to a Double

There are a number of frameworks that will do that mapping/conversion for you, and present you with a populated bean from the request object.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!