?
Solved

Session handling in Pop up jsps

Posted on 2003-03-05
13
Medium Priority
?
1,481 Views
Last Modified: 2013-11-28
Working in Java/Jsp arch. I have two levels of Pop ups (invoked using showModalDialog() method of javascript) coming up from a parent browser window. Should I handle anything special for keeping all these modal dialogs to be in same session? Because, during debug, the session id is differing when new pop up is opened and the data stored by Parent session is not accessible from child. Is that there something I'm missing?
0
Comment
Question by:prabudoss
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 3
  • +2
13 Comments
 
LVL 3

Expert Comment

by:allahabad
ID: 8072850
Are you using url rewrite to maintain session ?
If you are using url rewrite to maintain session, your session will be different for the new window, however, if you use cookies, same session  will be maintained by the server when new window in opened.
0
 
LVL 14

Accepted Solution

by:
kennethxu earned 100 total points
ID: 8073049
1. you must enable cookie in your browser unless you opt for url rewrite for session control.
2. if you use url rewrite, you must pass all your url through response.encodeURL().
3. make sure you test your app on IE or NS, don't do it from IDE, because some IDE integrated browsers have problem to handle cookies in different windows.
0
 

Author Comment

by:prabudoss
ID: 8073118
I'm amateur in this area. I'm using session like this

in doGet,
HttpSession thisSession = aRequest.getSession();

then to store data in session
thisSession.setAttribute(xxx, data);

to retrive from session,
httpsession.getAttribute("xxx");


This is what I have in jsp regarding cache.
<%
     
     response.setHeader("Cache-Control", "no-Cache");
     response.setHeader("Pragma", "No-cache");
     response.setDateHeader("Expires", 0);
%>

Anything alarming you?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 19

Assisted Solution

by:cheekycj
cheekycj earned 100 total points
ID: 8073160
how do you know the session ID is different?

Are you outputting it or just not seeing your vars set?

CJ
0
 

Author Comment

by:prabudoss
ID: 8073432
I basically store this session object in a map in a helper class and use that helper class to talk to session object in rest of the application. I step through the code and I got that session id is differing and also my values whatever I stored in Parent is missing. Below is the values I got in one of the Parent

SessionObject=
Session Object Internals:
id : X3BQETYAAAAANQFILOHH2EY
hashCode : 14371
create time : Wed Mar 05 23:07:54 GMT+05:30 2003
last access : Wed Mar 05 23:08:24 GMT+05:30 2003
max inactive interval : 1800
user name : anonymous
valid session : true
new session : false
session active : true
overflowed : false
session application parameters : com.ibm.servlet.personalization.sessiontracking.SessionApplicationParameters@1be
session tracking epm app data : com.ibm.servlet.personalization.sessiontracking.SessionTrackingEPMApplicationData@4024
enable epm : true
non-serializable app specific session data : {}
serializable app specific session data : {LogonUser=User@78b, OrderAsUser=User@4e38, TransactionObject=OrderTransactionData@49a5}

session data list : Session Data List ->  id : X3BQETYAAAAANQFILOHH2EY next : LRU prev : MRU


and when I'm in first level of Pop up and got session object and got same id "X3BQETYAAAAANQFILOHH2EY" as in parent but when I opened second level of Pop up (using showModalDialog()) this id was differing and I could not see any app specific data.
0
 
LVL 19

Expert Comment

by:cheekycj
ID: 8073905
the second level popup is a page in the same application?

CJ
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 8074342
could you please try this test jsp and let us know the result? it will show if you get the same session or not.

<HTML>
Session ID: <%= session.getId() %> <p>
Cookies:
<script>
document.write(document.cookie);
</script>
<p>
<%
    if( request.getParameter( "test" ) == null ) {
         session.setAttribute( "test", "Test string in session" );
    } else {
         out.println( "Attribute: " + session.getAttribute( "test" ) + "<p>" );
    }
%>
<a href="?test" target="new">new window</a>
</HTML>
0
 

Author Comment

by:prabudoss
ID: 8080291
I tried to use the test jsp. This problem is somewhat not consistently occuring. Sometimes I could get the same session across the children Pop ups. But few times the session id varies. May be VAJ test env has something to with this. Any idea of this?
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 8081392
>> May be VAJ test env has something to with this

Yes, I have heard similar problem been reported for other tools as well as VAJ.

Try to use IE or NS connect to real server.
0
 
LVL 19

Expert Comment

by:cheekycj
ID: 8081566
yes use a regular browser.

a popup in VAJ maybe opening a new browser session (new instance of the browser) rather than a new browser window (within the same session)

CJ
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 8108545
do you still have this problem when you use IE?
0
 
LVL 35

Expert Comment

by:girionis
ID: 10040950
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

- Split points between kennethxu and cheekycj

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

girionis
EE Cleanup Volunteer
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this blog, I will share you some basic tips for content marketing and to rank your website on Google.
Choosing a core focus or particular set of features and options can be tough. To help out, we’re going to highlight a handful of things your business needs on one of your social media pages. In other words, if one of these is missing, you should imp…
An overview of how to create reports in Adobe Analytics (formerly Omniture Site Catalyst) using pageNames, events, eVars and props. This video will show you how to install the Omniture Debugger tool so can see (and test) what is being passed int…
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question