IM SORRY I HAVE NO IDAEL, I AM COMPUTER ILLERATITE BUT I DO NOT WISH TO BE A 
MEMBER OF YOUR SITE BECAUSE I VISITED IT BY ACCIDENT, PLEASE REMOVE ME FROM 
YOUR MAILING LIST.
I HOPE YOU FIND SOMEONE TO HELP YOU AND GET YOUR PROBLEM STRAIGHTEN OUGOOD LUCK!

-----Original Message-----
From: XiaoPeng <[EMAIL PROTECTED]>
Sent: Apr 24, 2005 8:30 PM
To: tomcat-user@jakarta.apache.org
Subject: tomcat jsp problem with cookies

Dear Sir/Madam,

This is XiaoPeng here. I am using Tomcat 5.5.8 and JDK 1.5 to develope a project
now. The problem is the cookie is not stable. I had tried many times,
and tried to use session insead of cookie, but seems it doesn't work.
The cookie code is showing below,
------------------------------set cookie-------------------------
String cookieName="userlogin";
 Cookie userCookie = new Cookie("user", uname1);
 userCookie.setMaxAge(-1);
 userCookie.setPath("/");
 response.addCookie(userCookie);

------------------------------get cookie--------------------------
Cookie cookies[]=request.getCookies();
Cookie uCookie=null;
String username=null;
String uservalue=null;
if(cookies==null){
%><jsp:forward page="error.htm"/><%
}else{
       uCookie=cookies[0];
   username=sCookie.getName();
       uservalue = sCookie.getValue();
}
--------------------------------------------------------------------------

Is there any error in my code? Or there is any way to wok?

Thank you very much!
Hope to hear from you soon!

Regards
XiaoPeng

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to