i have two pages. one for say first.jsp and second page is second.jsp. where second.jsp i am using for inserting data in the database.i am calling second.jsp in first.jsp action.
i am using
response.sendRedirect("first.jsp"); from second.jsp to redirect to first page after doing all processing.
but i am getting this error
c_id java.lang.NumberFormatException: null
here c_id is my hidden field value.
regards.
-
how to redirect to a page (2 messages)
- Posted by: sukhbir bhavra
- Posted on: June 06 2001 01:09 EDT
Threaded Messages (2)
- how to redirect to a page by U V on June 06 2001 22:32 EDT
- how to redirect to a page by Eric DeFazio on June 17 2001 00:58 EDT
-
how to redirect to a page[ Go to top ]
- Posted by: U V
- Posted on: June 06 2001 22:32 EDT
- in response to sukhbir bhavra
Error is coming because after doing all process in second.jsp, somewhere the c_id value is becoming null and redirecting to the first.jsp, which is using the value of c_id by converting it to int. Since, you are trying to converting a null value - which throws the NumberFormatException
-
how to redirect to a page[ Go to top ]
- Posted by: Eric DeFazio
- Posted on: June 17 2001 00:58 EDT
- in response to sukhbir bhavra
If I understand this problem correctly, you want to send a redirect to "Second.jsp" while sending the value of the hidden field "c_id" wiht it...
If so, you should have a form on "first.jsp" which has the action to "second.jsp" inside the post tags make sure you have the c_id hidden field.
You can send a redirect in the response.sendRedirect("second.jsp") fashion you described, but this willnot be aware of the hidden field... to do this you could do
respose.sendRedirect(UrlEncoder.encode("second.jsp?c_id=<value here>"); wher the value would be equal to what was in the hidden field... keep in mind though, this value will be visible in the browser.
Cheers,
Eric
you need to specifify the hidden filed
I think the probelm here