Results 1 to 4 of 4
- 05-10-2010, 08:29 AM #1
Member
- Join Date
- May 2010
- Posts
- 9
- Rep Power
- 0
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
- 05-10-2010, 10:27 AM #2
Try to retrieve the value stored in Cookie.If you not,let us see.
Ramya:cool:
- 05-10-2010, 03:29 PM #3
Member
- Join Date
- May 2010
- Posts
- 9
- Rep Power
- 0
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.
- 05-11-2010, 01:04 PM #4
Member
- Join Date
- May 2010
- Posts
- 9
- Rep Power
- 0
Similar Threads
-
Annoying problem class/interface error
By Chick786 in forum New To JavaReplies: 2Last Post: 04-11-2010, 04:36 PM -
Generating Exe files from my project...
By agusCba in forum AWT / SwingReplies: 7Last Post: 04-02-2010, 08:56 AM -
plz help me solving this small but annoying problem!! plz.. i need help urgently.
By Y. Progammer in forum New To JavaReplies: 13Last Post: 02-20-2010, 07:56 PM -
Problem generating jar files with ext Class folder
By nespresso in forum EclipseReplies: 0Last Post: 10-06-2008, 03:42 PM -
Annoying database problem!
By DC1 in forum New To JavaReplies: 2Last Post: 05-29-2008, 09:43 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks