You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Christopher Becker <CB...@cablevision.com> on 2006/01/12 17:30:56 UTC

Maintaining session state in remote servlet form post

We have a struts app (v1.2.7) that uses Tiles for UI presentation,
running in WebLogic 8.1.  We are trying to implement a form whose action
is to a remote servlet. The remote site actually generated the form
details for us, and one of the fields provided is a hidden field
entitled returnURL, which allows me to provide a URL to a page within my
web app. 
 
When the form is submitted, the remote servlet  returns to the URL
specified in the returnURL parameter, but the user session is lost and
the relative links for images in the tiles layout disappear.
 
We have tried appending the session id to the URL sent in the hidden
returnURL of the form, but this did not work. We then changed from URL
rewriting to cookies for handling session state, but this also did not
work.
 
Does anyone have any ideas on how to maintain session state when
posting to a remote servlet?
 
Regards,
 
--Chris
 

Re: Maintaining session state in remote servlet form post

Posted by Laurie Harper <la...@holoweb.net>.
Christopher Becker wrote:
> We have a struts app (v1.2.7) that uses Tiles for UI presentation,
> running in WebLogic 8.1.  We are trying to implement a form whose action
> is to a remote servlet. The remote site actually generated the form
> details for us, and one of the fields provided is a hidden field
> entitled returnURL, which allows me to provide a URL to a page within my
> web app. 

That sounds eerily familiar ;-)

> When the form is submitted, the remote servlet  returns to the URL
> specified in the returnURL parameter, but the user session is lost and
> the relative links for images in the tiles layout disappear.

What do you mean, 'the remote server returns to' the URL? Does it send 
the browser a redirect, or load the URL and proxy the result back to the 
browser?

I can't think why relative URLs in your tiles would break unless the URL 
you're passing to the remote servlet is incorrect, or your URLs are 
built using session data that's missing due to the session tracking 
problems you're seeing.

> We have tried appending the session id to the URL sent in the hidden
> returnURL of the form, but this did not work. We then changed from URL
> rewriting to cookies for handling session state, but this also did not
> work.
>  
> Does anyone have any ideas on how to maintain session state when
> posting to a remote servlet?

The key is retaining session state when you come *back* from the remote 
servlet. And that depends on how the return is handled. Assuming the 
remote servlet sends a browser redirect -- so that the browser is making 
a fresh request to your application -- either URL rewriting or cookies 
should work fine.

You might want to try using a packet sniffer to monitor exactly what 
HTTP requests are being sent between the browser, your app and the 
remote app. That might give a clue as to where in the chain things are 
getting out of sync.

L.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org