Hi All, I have created a html page having a checkbox and two servlet.When a user select submit the form using the get method it tranfer the req to first servlet.First servlet redirect the request to the next servlet using response.redirect("url") what i need it is the second servlet has to collect the data selected by the user.The problem is iam unable to find the selected checkbox by the user.O/P iam getting is NullPointerException The code is: Html Page : <html> <head>this is 3 parmeter <title>this is first</title></head> <body> <form Method =get action = "redi"> color :<select name = "c"> <option> light <option> dark <option> thick <option> amber </select></br> <input type = checkbox name =a value = "first">first</br> <input type =checkbox name =a value ="second">second</br> <input type =checkbox name =a value = "third">third</br> <input type = "submit"> </form></body> </html>
First Servlet code is import javax.servlet.*; import javax.servlet.http.*; import java.io.*;
I do not doubt that the redirect is happenning so I will assume that your question is "Why is the posted parameter lost?"
When you re-direct you return to the browser and the browser sends a new request (which does not have your posted info) to where ever you wanted to re-direct. If you forward, you will not lose your posted information
Please let us know if this was your question and that you have received the information you need to understand what is happening
Joined: May 30, 2007
Hi Michael Ku, Thanks a lot you are perfactely rignt and your explaination cleared my doubt. regards sankar