File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

"Window scope"

 
Jiri Nejedly
Ranch Hand
Posts: 83
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Preeti Arora
Ranch Hand
Posts: 74
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64173
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic