File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes EmployeeID=(int)request.getParameter( Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "EmployeeID=(int)request.getParameter("EIN").trim(); code in servlet giving an error inconvertible tp" Watch "EmployeeID=(int)request.getParameter("EIN").trim(); code in servlet giving an error inconvertible tp" New topic
Author

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

Vishal Hegde
Ranch Hand

Joined: Aug 01, 2009
Posts: 1055

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();


http://www.lifesbizzare.blogspot.com || OCJP:81%
Louis Bros
Ranch Hand

Joined: Jun 03, 2011
Posts: 54

Take a look at Integer and it's parseInt(String s) method.


OCA7
Harsha Ka
Ranch Hand

Joined: Mar 14, 2010
Posts: 45

This will work:



SCJP 1.6,Preparing (Tryin to prepare) for scwcd
Vishal Hegde
Ranch Hand

Joined: Aug 01, 2009
Posts: 1055

God I forgot parseInt() I will have to revise core java again
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: EmployeeID=(int)request.getParameter("EIN").trim(); code in servlet giving an error inconvertible tp