Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Unable to convert lang.Object to int [solved]

 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a session object which has to be converted in to 'int'. I am trying to convert lang.Object to lang.String and then to int....I am able to convert lang.Object to lang.String but not able to do lang.String to int.
code that gives error...


error reported...

[ January 06, 2006: Message edited by: Raghavan Chockalingam ]
 
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure this line:



is returning a valid numeric String? It looks like the call to request.getParameter("Id") is returning null and, when you call Integer.parseInt("null"), you get a NumericFormatException.

Perhaps you want to call request.getAttribute("Id"), instead?
[ January 06, 2006: Message edited by: Corey McGlone ]
 
Raghavan Chockalingam
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are right!!!,,,it was returning null, I jus noticed that I have put 'Id' instead of 'id' which should be in place when you said it might be returning null
thanks....
 
Do not threaten THIS beaver! Not even with this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic