Claude,

Try this one: 

ActionForward af=new ActionForward(response.encodeRedirectURL(
"http://12.2.33.13:40000/Consumer/receiveSession.do";),true);

It's gonna add jsessionid as well, if necessary, see
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/http/HttpServletResponse
.html#encodeRedirectURL(java.lang.String)

However, strange if Struts isn't doing this already...

Vadim.

-----Original Message-----
From: Claude Libois [mailto:[EMAIL PROTECTED] 
Sent: Thursday, December 09, 2004 9:32 AM
To: [EMAIL PROTECTED]
Subject: Transmission of a session using jsessionID

Hi all,
I try to keep my session after a redirect in struts but it doesn't work. So
I made a test application with an action sendSession.do and an other action
receiveSession.do.
Here are the code of those two simple action:
************
sendSession.do
************
public class sendSession extends Action {
    public ActionForward execute(ActionMapping actionMapping,
                                 ActionForm actionForm,
                                 HttpServletRequest servletRequest,
                                 HttpServletResponse servletResponse) {
        System.out.println("***************** sessionId before redirect"
+servletRequest.getSession().getId());
    servletRequest.getSession().setAttribute("test","test");
    ActionForward af=new ActionForward(
            "http://12.2.33.13:40000/Consumer/receiveSession.do;jsessionid=";
+
            servletRequest.getSession().getId(),true);
    return af;
    }
}
*************
receiveSession.do
*************
public class ReceiveSession extends Action {
    public ActionForward execute(ActionMapping actionMapping,
                                 ActionForm actionForm,
                                 HttpServletRequest servletRequest,
                                 HttpServletResponse servletResponse) {
     System.out.println("***************** sessionId after redirect"
+servletRequest.getSession().getId());
    System.out.println("test
"+servletRequest.getSession().getAttribute("test"));
return null;
 }
}

What's wrong with it? the attribute "test" is null in receiveSession.do
Is there anything else to do for session sharing between two web app??

Thanks in advance

Claude Libois
[EMAIL PROTECTED]
Technical associate - Unisys


---------------------------------------------------------------------
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