Looks like you've not pasted the complete jsp file. Obviously by looking at the code you've pasted, the tags are not closed properly. Could you please paste your complete jsp file with the changes suggested by jan earlier. What Jan suggested should work as far as to set cookies.
[Message sent by forum member 'cchidamb' (cchidamb)]
http://forums.java.net/jive/thread.jspa?messageID=254328