Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

error in request.addCookie(c)

 
tangara goh
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I'm testing out a servlet which will track the user name from a html page.

The servlet is supposed to list the cookie with the user name.

However, when I run the Netbean IDE, it shows me error at the request.addCookie(c);



What part have I done wrongly?



 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it shows me error at the request.addCookie(c)

Posting the error would help a lot.

Check the following : Is there a addCookie method in HttpServletRequest ? If not, where is this method ?
 
tangara goh
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The error appeared in netbean IDE is just red color so you know there's mistake at that line.

And also when I run the html file, it gives me a blank with nothing appear there.

May I know how to create the addCookie method?

 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't want to *create* the method, you want to know where it actually *is*.

Hint: There's no point in adding a cookie to a *request*--a new cookie would get sent *back* to the client.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic