-----------------------------
Please read the FAQ!
<http://java.apache.org/faq/>
-----------------------------
I'm trying to delete the cookie with setMaxAge(0), but nothing happens
!
What can I do for that.
Thank for any reply
Sebastien
[EMAIL PROTECTED]
> -----Original Message-----
> From: Francois [mailto:[EMAIL PROTECTED]]
> Sent: jeudi 9 septembre 1999 18:25
> To: Java Apache Users
> Subject: Re: Cookies
>
>
> -----------------------------
> Please read the FAQ!
> <http://java.apache.org/faq/>
> -----------------------------
>
>
>
>
> > Also I assume it is just an extremely funny typo, but the
> correct call is
> > addCookie()
> > not
> > assCookie()
> >
>
> you are right :-D
>
>
>
> But look at some piecies of my code, I do not send anything
> before cookies !!!
> UPDATE and DELETE actions don't work
>
>
>
> --------------------------------------------------------------
> -----------------------
>
> public void doPost(HttpServletRequest req,
> HttpServletResponse res) throws ServletException, IOException{
>
> res.setContentType("text/html");
> PrintWriter out = new PrintWriter(res.getOutputStream());
>
>
> String action=req.getParameter("ACTION");
>
> log("doPost", "ACTION=" + action);
>
> if (action != null) {
>
> String cName=req.getParameter("name");
> log("doPost", "name=" + cName);
>
>
> if (action.equals("ADD") ) {
> if ( cName != null) {
> String cValue=req.getParameter("value");
> log("doPost", "VALUE=" + cValue);
> Cookie c = new Cookie(cName, cValue);
> res.addCookie(c);
> }
> }
> else if (action.equals("UPDATE") ) {
> Cookie c = findCookie(req.getCookies(), cName);
> if (c != null) {
> c.setValue(req.getParameter("value"));
> c.setComment(req.getParameter("comment"));
> c.setPath(req.getParameter("path"));
>
> try {
>
> c.setMaxAge(Integer.parseInt(req.getParameter("maxAge")));
> }
> catch(Exception e) {
> }
> try {
>
> c.setVersion(Integer.parseInt(req.getParameter("version")));
> }
> catch(Exception e) {
> }
> }
>
>
> }
> else if (action.equals("DELETE") ) {
> Cookie c = findCookie(req.getCookies(), cName);
> if ( c!=null)
> c.setMaxAge(0);
> }
> }
> sendMainFrame(out);
> out.close();
> }
>
>
>
>
> public Cookie findCookie(Cookie[] cookies, String cName) {
> for(int i=0; i < cookies.length; i++) {
> if (cookies[i].getName().equals(cName))
> return cookies[i];
> }
> return null;
> }
>
>
>
> public void sendMainFrame(PrintWriter out) throws IOException{
> out.println(
> "<frameset cols=\"180,*\" frameborder=NO
> border=0 name=MOTHER>" +
> "<frame
> src=\"/servlets/Cookies?ACTION=MENU\" name=MENU>" +
> "<frame
> src=\"/servlets/Cookies?ACTION=MAIN\" name=MAIN>" +
> "</frameset>");
> }
>
>
>
> --------------------------------------------------------------
> -----------------------
>
>
>
>
> regards
>
> Fran�ois
>
>
>
> --
> [EMAIL PROTECTED]
> BULL-CITB tel:(+33) 556 437 848 Home:
> [EMAIL PROTECTED]
> 207, cours du M�doc fax:(+33) 556 437 978
> http://www.citb.bull.net
> 33000 Bordeaux BullCom: 227
> 7848 ICQ :3886291
> --------------------------------------------------------------
> ------ Linux -----
>
>
> --
> --------------------------------------------------------------
> Please read the FAQ! <http://java.apache.org/faq/>
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> Archives and Other: <http://java.apache.org/main/mail.html>
> Problems?: [EMAIL PROTECTED]
>
--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Archives and Other: <http://java.apache.org/main/mail.html>
Problems?: [EMAIL PROTECTED]