Newsletter sign-up
View all newsletters

Enterprise Java Newsletter
Stay up to date on the latest tutorials and Java community news posted on JavaWorld

JavaWorld Daily Brew

java.lang.IllegalArgumentException: Cookie name "My ice cream" is a reserved token


Tags:

I'm experimenting with cookies. I created a html form where there is an input value="my ice cream".

When I run it, it's supposed to display in a servlet or jsp also can the "my ice cream" and the cookie id.

But, netbean ide is throwing me a java.lang.IllegalArgumentException Cookie name "My ice cream" is a reserved token.

What went wrong and how to rectify it to make the servlet display the words separtely. The funny thing is that if I joined the words, there'd no problem at all.

Hope to have some insight into this problem and suggestion to correct the codes.

Many thanks.