Discussions

Performance and scalability: how to redirect to a page

  1. how to redirect to a page (2 messages)

    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.

    Threaded Messages (2)

  2. how to redirect to a page[ Go to top ]

    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

  3. how to redirect to a page[ Go to top ]

    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