• 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

"Window scope"

 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am writing web application (Spring MVC, ...). I need to pass some attribute (or parameter) into page creted in new window (codebook, table) and then pass the same attribute to every other page called from there (codebook, form). Little simplification - every new page is opened in the same window (javascript window.open(...)). The attribute should live as long as the window (codebook) lives. I need some "window scope".
Does exist some technique to do this? Thanks.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In a stateless protocol, like HTTP, there is no way to tie any of the server side scoped objects to the length of time that a browser window is open.
If you need a server side object to live longer than the time that it takes to respond to an HTTP request you'll need to use either session or context (appication) scope.
 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Probably you can try
window.opener.document.formname.fieldname.value

This value is from previous window which has opened the new window.
Make any variable in the new window and assign this value to it.
 
Sheriff
Posts: 67746
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

Originally posted by Preeti Arora:
Probably you can try ...



Which is rather klunky and can only work if the original opening page is never refreshed, or navigated away from , or the browser closed, and so on.

The session is a much better and safer place to store such values.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic