aspose file tools*
The moose likes Servlets and the fly likes iframe session problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "iframe session problem" Watch "iframe session problem" New topic
Author

iframe session problem

Niels Bosma
Greenhorn

Joined: Jun 08, 2005
Posts: 3
We have a problem with running a site in an iframe. We've developed a system that uses session variables but when running the site in an iframe we get weird (non-exsisting) behavior with the session vars.

Even more weird is that if I open the page (that's runned in the iframe) and do some stuff that affects the session and then open the page with the iframe, it works fine...

Note that the page that loads the other page via the ifram is on a diffrent server...

Someone know why I get this behaviour?
/Niels
Jeffrey Spaulding
Ranch Hand

Joined: Jan 15, 2004
Posts: 149
Session persistence is handled via cookies. If you have different servers in the game, the cookies might become invisible (depends on the domainnames).

You can use Plan B for session persistence by rewriting your url as in



You have to do that by force and not with HttpServletResponse.encodeURL()
since as soon as cookies are active there is no rewriting done.

J.
Niels Bosma
Greenhorn

Joined: Jun 08, 2005
Posts: 3
Ok, thanks. Gonna be a fun workday then, rewriting all url's and actions.

You have to do that by force and not with HttpServletResponse.encodeURL()
since as soon as cookies are active there is no rewriting done.


What do you mean with by force?
Niels Bosma
Greenhorn

Joined: Jun 08, 2005
Posts: 3
So I need to create a function that takes an url and appends the session var? What parameter name? 'jsessionid'?

Will the servlet-container automatically understand that this is a sessionid??

What is the best algorithm for this function?
/Niels
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: iframe session problem