• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

frames and pageContext

 
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
say there are 5 frames, each accessing some jsp pages, even to the same jsp page but with different parameters and forwarded.
Their pageContext are different! ok?
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That is correct - the "page" context exists only with a single JSP and request.
Bill
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When using frames it's important to remember that each frame is its own window. Despite the fact that the browser groups them together to appear as a single page to the user, they are not different from the server's point of view than multiple browser windows.
bear
 
Brusk Baran
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But their sessions (if any) are the same???
 
Brusk Baran
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
0OK I c..
They are each in fact an individual browser window, but since the session Cookie is normally set with the domain name as host target, each of these framed jsp pages will send the same cookie created by any of the framed jsp pages. SO in effect they share the same session........ thx...
 
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also important to note that since each frame causes a separate request, there could well be multiple request Threads trying to work with session variables "at the same time" - you may have to synchronize access.
Bill
 
Brusk Baran
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hoi William,
actually I am using JavaScript to force the other frames location.href to be replaced also. In fact they all are forwarded to the same ctroller.jsp page , but with different parameters.
so request is different but session is the same. You are right, I must synchronize the session based code parts.
But do you know which frame gets forwarded to the server first? in order or is it browser specific?
 
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't think you can rely on the browser to follow a particular order - that sounds like a job for your JavaScript. I suspect you will have to get tricky with Javascript to ensure that Frame 1 has gotten a complete page before sending the request for Frame 2 - its an interesting problem.
Bill
 
Bear Bibeault
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The only way to ensure order is to fire off a "chain" by updating subsequent frames in the onLoad handlers of each frame. Messy.
bear
 
Brusk Baran
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I must just ensure that the login frame, which will later cause a session to be created to be sent first. so that the server knows the domain name of the Cookie he just creates and handles the other frames' request according to this session.
OR must I really ensure that the login frame response be sent to the client , and then send send the first requests of the other frames??
what is the way? Must the cookie be sent by the browser? or if a session cookie has been already created on the server side? does that suffice that the existence of a session?
 
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The cookie Id value that identifies the session absolutely must be set by a response sent to the browser BEFORE any other requests. Otherwise each request may cause creation of a new session and cookie Id value.
Can you have a simple initial request/response cycle before loading the individual frames? That could be the request that created the FRAMESET.
Bill
 
Brusk Baran
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I cannot set the session @ the first request which is to the index.jsp (the main frameset containing 4 frames: top, corner, navigate [=login],and main).
B'cos the client must sign on with a logname and password.
Q1. Is it the happening, that the same site might have different sessions for a unique host, @ the same time? It shouldn't.then no problem, but otherwise:
Q2: if it can, then my solution will be : send request to the server with the left frame window only... Donot send the other frames anyhow with js. and when he logs on successfully, get the session in the left.jsp & on its code add (if session!==null)---> execute some javascript code which will change the locations of the other frames , with some from session retrieved parameters also: say self.parent.mainFrame.location.href=some-RelativeURL?parX=<%=session.getX.toString()%>&parY=vvv&lang=fr&..... I hope this will work. I will create a test situation as soon as possible.
 
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are on the right track. Why not have the other initial frames loaded with static pages just so they won't look odd and disturb the customer.
Let us know how it works out.
Bill
 
Brusk Baran
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi William, it works fine.
Just I am writing the specs and also at the same time implementing new functionality for an already existing application; they already have a login facility and have many frames etc.
The login that will be added by me is an extension. for ex. ne can log in as an existing user, as my extended login which are two different logins; and also login as both, one by one I mean.
so on the left frame(where the two different login name/passwd boxes will be simultaneously existing), there is still a lot to do.
Existently there are horrible Layers, which make my work very difficult to integrate the new functionalities, without disturbing the working schema:
The existing JavaScript functions, layers, and frames are all coupled with each other. I guess writing the whole application from scratch would be better from my side, but unfortunately the business doesnot agree. They think it is piece of cake to add this utility.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic