It's highly likely you are trying to do something that you shouldn't. Messing up with session cookie is something the container takes care of. What are you trying to accomplish with session cookie's value?
And, for whatever reason you are doing it, you should do it in a Servlet and never in a JSP. Again, having to mess up with session token's value indicates something is wrong in your application design.