Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EmployeeID=(int)request.getParameter("EIN").trim(); code in servlet giving an error inconvertible tp

 
Vishal Hegde
Ranch Hand
Posts: 1077
Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Ranchers,

The below Code line is giving an error Inconvertible types: even after putting int in front of it

EmployeeID is an Int datatype variable and when parsing a string element to an Int its giving the error.Please let me know where I am going Wrong

EmployeeID=(int)request.getParameter("EIN").trim();
 
Louis Bros
Ranch Hand
Posts: 54
Java Tomcat Server Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at Integer and it's parseInt(String s) method.
 
Harsha Ka
Ranch Hand
Posts: 45
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This will work:

 
Vishal Hegde
Ranch Hand
Posts: 1077
Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
God I forgot parseInt() I will have to revise core java again
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic