tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Abhilash V. Sonwane" <abhil...@elitecore.com>
Subject Re : How to cast JSP request String to int?
Date Mon, 21 Aug 2000 06:46:51 GMT
this is basic java 
use Integer.parseInt() method from the Integer class


----- Original Message ----- 
From: Thomas <lightspring@jps.net>
To: tomcat-user@jakarta.apache.org 
Sent: Mon Aug 21 12:06:43 GMT+05:30 2000 
Subject: How to cast JSP request String to int?


 How do you use a number from a request parameter in an equation using JSP?  In other words,

How do you set the value of an int variable to the value of a numeric String variable?

I tried to do:

int Repeat1__numRows = 10;
if(request.getParameter("num_results")!=null) {
 Repeat1__numRows = (int)request.getParameter("num_results");
}

But the engine (tomcat 3.1 and jdk 1.3) says: 

Invalid cast from java.lang.String to int 

thanks for a tip,
Thomas



____________________________________________________________
eLitecore Technologies Pvt. Ltd.


Mime
View raw message