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

Session in Pop up window ?

moh sak
Ranch Hand

Joined: May 11, 2005
Posts: 78
hi all,

I want to ask is it posible to pass a session from a page to a pop up window ?? I try it and it does not work ?!


thanx in advance.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

I assume you mean, does a popup window operate under the same session (pass the same session cookie value) as it's opener.

Yes.

When you say you tried it, what did you do? What were the results that you saw. What was different from your expected results?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
moh sak
Ranch Hand

Joined: May 11, 2005
Posts: 78
hi ben,

i set an atribute in the sesstion and click on a button that opens the pop up window, i prnt the sesstion id when the page loads and the Id's where deff. , maybe i did something wrong !!
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

I have heard (but don't know the details of) a bug in MSIE that causes this.
Someone else may be able to elaborate.
moh sak
Ranch Hand

Joined: May 11, 2005
Posts: 78
hi again,

thanx for your replay, can I know what exactly id you mean by "pass the same session cookie value" ? is it the same way of setting an atribute and submit the form then in the next page we get the atribute from that sesstion ?!!!
Jeffrey Spaulding
Ranch Hand

Joined: Jan 15, 2004
Posts: 149

i set an atribute in the sesstion and click on a button
[/QB]


The HTML behind the button plus the code where you set the value would be
a great help here.

Do you have cookies enabled in the machine in question?

Do you do URL rewriting when filling the popup?

Do sessions work for pages other than this pop up?

J.
moh sak
Ranch Hand

Joined: May 11, 2005
Posts: 78
Do you have cookies enabled in the machine in question?


yes coockies enabled.

Do you do URL rewriting when filling the popup?


no i dont i just open a new window.

Do sessions work for pages other than this pop up?


yes it did.
Sharad Agarwal
Ranch Hand

Joined: Sep 11, 2002
Posts: 167
Originally posted by Jeffrey Spaulding:
The HTML behind the button plus the code where you set the value would be a great help here.


moh sak - perhaps if you posted these, we could help you better.


Alco-Haul: We move spirits.
Demented Deliberations of a Dilettante
moh sak
Ranch Hand

Joined: May 11, 2005
Posts: 78
here is what i'm doing :

-----input type=button Click="doTest()"

------
script
------

func doTest(){
win...open("test");
}

sorry i could not add the original code because the site says that it contains some evil script or something !!!

as you can see i try to redirect the page into another one and get the sesstion from that page and the result was : the ID is the same one in the parent window, but when i open another window a new session will be created.

any ideas ???!
Sharad Agarwal
Ranch Hand

Joined: Sep 11, 2002
Posts: 167
The javascript looks good. Can we now look at the server side code which accesses the session?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60057
    
  65

Have you tried this on other browsers? That would help narrow down whether it's something in your code or environemnt, vs an IE-ism.
[ July 12, 2005: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

A quick google search with "session bug window.open" brought this up:
http://support.microsoft.com/kb/q196383/



[BPS update]
Argg.. Posted it too soon:
This is probably not applicable (unless you're using a REALLY old version of MSIE).

APPLIES TO
�Microsoft Internet Explorer 4.0 128-Bit Edition
�Microsoft Internet Explorer 4.01 Service Pack 2
�Microsoft Internet Explorer 4.01 Service Pack 1

[ July 12, 2005: Message edited by: Ben Souther ]
moh sak
Ranch Hand

Joined: May 11, 2005
Posts: 78
Hi all,

thanx for your help

Have you tried this on other browsers?

in fact I didn't, but when I read the article in the microsoft help and support site that Ben include in his post it seams its a bug in the IE .
Is that mean that there is no way to solve it programaticly ??

thanx again.
[ July 13, 2005: Message edited by: moh sak ]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

As I later pointed out. It's a bug in older versions of IE.
You're not using MSIE 4x, are you?

If so, or if you plan to support versions going back that far, you may need to re-think the way you build your app and not put session dependent pages in pop-ups.

There will be quite a few client side (Javascript) tricks and techniques you will have to steer clear of too.
moh sak
Ranch Hand

Joined: May 11, 2005
Posts: 78
Hi,

thanx for your help i'll try to solve the problem , i think i'll cancle the pop up windows at all !!

thanx again
Sharad Agarwal
Ranch Hand

Joined: Sep 11, 2002
Posts: 167
moh sak - What you are trying to do is very standard and should work. I would hate to mess with usability for convenient development in this case. Maybe you are doing something on the server side that is invalidating the session.

Originally posted by Sharad Agarwal:
The javascript looks good. Can we now look at the server side code which accesses the session?
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

It would also be helpful to know what browser and version you are using.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Sharad Agarwal:
moh sak - What you are trying to do is very standard and should work. I would hate to mess with usability for convenient development in this case. Maybe you are doing something on the server side that is invalidating the session.


Usability is often sacrificed in lieu of broad browser support.
If he needs to support those versions that have that bug, not relying on sessions in popup windows may be a necessary trade off.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Session in Pop up window ?
 
Similar Threads
Losing session data on closing a pop up window and refreshing the parent
setInterval Overhead
Session
Pop up window issue
javascript:window.close() not working in firefox