What do you mean "change the name of the cookie?"  Are you doing an
res.addCookie() with another name?

Shivani wrote:

HI,

i am setting cookie parameters and retriving them in same servlet for
testing cookie class.

however, if i change name of cookie i have set and run this servlet, it
doesn't show me new name always. why is it anyidea? where should i find out
the new name in browser where it's put. pls. help!
thanks!
---------------------------------
example:
 public void doGet(HttpServletRequest req, HttpServletResponse res)
      throws ServletException, IOException
 {

//create a cookie and place it on the browser:
Cookie myCookie= new Cookie("cookie_test ", "22");

       PrintWriter out = res.getWriter();
       res.setContentType("text/html");

       res.addCookie(myCookie);

//get the cookie:
Cookie[] cookies = req.getCookies();

//asign name of 1st cookie to a string called cookie1
String cookie1=cookies[0].getName();
out.println("the name of cookie is:"+ cookie1);

}
-------------------

output is:
the name of cookie is:cookie_test

so if i change the name, it's not reflected in this output, why? am i doing
this right?

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html



___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to