Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is there a method that will return an int parameter from request obj?

Status
Not open for further replies.
Jan 8, 2001
163
US
Hi there! Is there a method that will return an integer from the request object? "request.getParameter" only seems to return a string.


int searchtype = (int)request.getParameter("searchtype");


Thanks in Advance,
CrystalVisualBOracle :)
 
Parameters are always returned as Strings, you need to do the conversion yourself.
Example:
Code:
int number;
if (request.getParameter("number") != null) {
  try {
    number = Integer.parseInt(request.getParameter("number"));
  }
  catch (Exception e) {
    /* Invalid Number Do Error Handling */
  }
}
Wushutwist
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top