That's right. Let's round all the kookies up and put them away!
Ok, but seriously, where exactly is the NPE? If you'd point out the line it would help determine what is causing the problem...this is pretty vague. And also, it looks like you're typing your code; please don't do that as it can mask errors and will be pretty frustrating for all involved.
You will need to round trip back to the browser to see the cookie. If you set the cookie into the response then, before you go back to the browser with the response and therefore set the cookie on the client, you go to the JSP, the cookie was never returned to the client and therefore will not be in the request.
When you make a second request to your web app, the cookie will be in the request.
Joined: Jul 24, 2007
Dear Tarun Yadav and Michael Ku,
Tarun Yadav,I apologize for writing the code here. I won't do it again.