how to perform integer validation in java class

Hi folks, I have to perform integer validation in java class , like iam getting parameter vcalue from jsp page .see my codeString test=request.getParameter("salary");then how to check that it is a integer.if not then i have to display error message.
[277 byte] By [RajeshwarReddyTa] at [2007-11-27 5:22:10]
# 1
[url= http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Integer.html#parseInt(java.lang.String)]Integer.parseInt( String )[/url] and a catch statement?
mlka at 2007-7-12 11:47:27 > top of Java-index,Java Essentials,New To Java...
# 2

hi............

String test=req.getParameter("salary");

PrintWriter out=res.getWriter();

try{

int i=Integer.parseInt(test);

out.println("salary is "+i);

}catch(Exception e)

{

out.println("Enter the salary in number");

}

Boss...Check it out.

Dutt.Javaa at 2007-7-12 11:47:27 > top of Java-index,Java Essentials,New To Java...
# 3
> }catch(Exception e) Every time you catch Exception the Goddess kills a puppy.
mlka at 2007-7-12 11:47:27 > top of Java-index,Java Essentials,New To Java...