My guess is that the cookie that you add in ActionA should really be added in your 
jspA. Not really sure though.

Rgs
V

-----Original Message-----
From: Brian Holzer [mailto:[EMAIL PROTECTED]]
Sent: Friday, June 07, 2002 4:20 AM
To: <
Subject: Struts and cookies


Hi all,
   I am hoping that this is an easy question.  I have ActionA, jspA and ActionB.  In 
ActionA I add a cookie to the response passed into the perform() method.

     Cookie cookie1 = new Cookie( "SGI", "autodev01" );
     response.addCookie( cookie1 );

  Then I exit ActionA with the following command

     return( mapping.findForward( fwd ) ); 

I am then forwarded to jspA where I enter some search criteria and press the submit 
button which forwards to ActionB.  In ActionB I use some displays to show the contents 
of the request passed into the perform() method 

      System.out.println( "OUTPUTTING HEADERS: " );
        Enumeration enum = request.getHeaderNames();
        while ( enum.hasMoreElements() ) {
           String k = (String) enum.nextElement();
           Object v = request.getHeader( k );
           System.out.println( "Key: " + k + "  Value: " + v.toString() );
        } // end of while

     Cookie sgiCookie[] = request.getCookies();
     System.out.println( "OUTPUTTING COOKIES: " );
     int w = 0;
     while( w < sgiCookie.length ){
        System.out.println( "Cookie number " + w );
        System.out.println( "Cookie name: " + sgiCookie[w].getName() );
        System.out.println( "Cookie value: " + sgiCookie[w].getValue() );
        System.out.println( "---------------------------" );
        w++;
     }

but the cookie I added is not there.  The only cookie still there is the jsessionid 
cookie.  I am using Silverstream 3.7.3 app server.

Does anyone know why my cookie is dissappearing?  or am I somehow not adding it in the 
right place? 

Thanks
Brian


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


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

Reply via email to