in my jsp pages, I use url to pass some integer parameters. such as code=5 simple enough But when the second page try to retrieve that number by Integer.parseInt(request.getParameter("code")); it gives me a NumberFormatException. It only happens on some cases, for example, if I have code=5 and anthcode=6, only code=5 will give me an exception, but anthcode=6 does not. I deleted the files in the tomcat-4.0.4's directly and restarted tomcat multiple times, and check double checked the difference between code=5 and anthcode=6, I am pulling my hair at the moment by this mystery. Any help is really appreciated.
Thanks Anthony; I doubled checked the spaces, there is no extra spaces. Another funny thing that it seems other of my java program can not handle Integer.parseInt any more. If I use Integer.parseInt(string), I get a number format exception. It not only occur on one of my computer, it occurs on both of them. I am really lost.
Hi, I am not able to detect the exact cause for your problem. But you can try one thing. Type-cast the request.getParameter() in to String before doing a parseInt. Also chect if the parameter you get is not null. If its null can cause the NumberFormatException. Kaustubh.
Kaustubh. Mumbai, India.
Joined: Jun 26, 2001
I find the problem. One of the required int paremeter is missing from one of the links After I fixed it, it all works now. One of the String parameter has a space missing. Thanks again