Results 1 to 4 of 4
  1. #1
    Burglar_Cat is offline Member
    Join Date
    May 2010
    Posts
    9
    Rep Power
    0

    Smile Annoying Generating Cookies files problem

    Hi, Masters:
    I encounter a problem for generate my own cookie files; I write a servlet class as belows:

    import javax.servlet.http.*;
    import javax.servlet.*;
    import java.io.*;

    public class TestCookie extends HttpServlet{

    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
    throws ServletException, IOException {
    resp.setContentType("text/html");
    Cookie cl1 = new Cookie("user" ,"somebody");
    Cookie cl2 = new Cookie("password","23123");
    resp.addCookie(cl1);
    resp.addCookie(cl2);
    cl2.setMaxAge(3600);
    resp.getWriter().println("Cookie Setted");
    }


    }

    But I can not see cookie files that generated in the corresponding directory;
    (C:\Users\Burglar_Cat\AppData\Roaming\Microsoft\Wi ndows\Cookies)
    My OS is win7 and my ide is MyEclipse 8.5. Both the mini explorer imbeded in
    ME and IE8 both can not generate the files. My securites sets on IE8 is Middle(
    and I've tried to set the level to lowest but does not work.) I am sure web.xml files configurated right.To something Peculiarly that some other websites I visited can generate cookie files in my PC. Can someone work my problem out?
    Thanks here

  2. #2
    RamyaSivakanth's Avatar
    RamyaSivakanth is offline Senior Member
    Join Date
    Apr 2009
    Location
    Chennai
    Posts
    765
    Rep Power
    6

    Default

    Try to retrieve the value stored in Cookie.If you not,let us see.
    Ramya:cool:

  3. #3
    Burglar_Cat is offline Member
    Join Date
    May 2010
    Posts
    9
    Rep Power
    0

    Default

    I must say sorry here. I should have annouced that I've another servlet file to retrieve values
    .here are another file
    import javax.servlet.http.*;
    import javax.servlet.*;

    import java.io.*;

    public class CopyOfTestCookie extends HttpServlet{

    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
    throws ServletException, IOException {
    resp.setContentType("text/html");
    Cookie ck[] = req.getCookies();
    int i;
    for (i = 0; i< ck.length; i++) {
    resp.getWriter().println(ck[i].getName() + "," + ck[i].getValue());
    }
    resp.getWriter().println("Cookie read");
    }


    }
    this file retrieve the value of the cookie created in TestCookie the first servlet class.

  4. #4
    Burglar_Cat is offline Member
    Join Date
    May 2010
    Posts
    9
    Rep Power
    0

    Default

    So, the problem is still on, even if I functionize codes to retrieve values. I hope someone can give me answers to work it out

Similar Threads

  1. Annoying problem class/interface error
    By Chick786 in forum New To Java
    Replies: 2
    Last Post: 04-11-2010, 04:36 PM
  2. Generating Exe files from my project...
    By agusCba in forum AWT / Swing
    Replies: 7
    Last Post: 04-02-2010, 08:56 AM
  3. Replies: 13
    Last Post: 02-20-2010, 07:56 PM
  4. Replies: 0
    Last Post: 10-06-2008, 03:42 PM
  5. Annoying database problem!
    By DC1 in forum New To Java
    Replies: 2
    Last Post: 05-29-2008, 09:43 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •