File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes IDEs, Version Control and other tools and the fly likes error in request.addCookie(c) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "error in request.addCookie(c)" Watch "error in request.addCookie(c)" New topic

error in request.addCookie(c)

tangara goh
Ranch Hand

Joined: Dec 27, 2009
Posts: 125
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é

Joined: Nov 24, 2005
Posts: 14688

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 ?

[My Blog]
All roads lead to JavaRanch
tangara goh
Ranch Hand

Joined: Dec 27, 2009
Posts: 125
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

Joined: Sep 29, 2008
Posts: 12617

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.
I agree. Here's the link:
subject: error in request.addCookie(c)
It's not a secret anymore!