File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark ""Window scope"" Watch ""Window scope"" New topic

"Window scope"

Jiri Nejedly
Ranch Hand

Joined: Oct 22, 2002
Posts: 83
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 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

Joined: Dec 11, 2004
Posts: 13410

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.

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

Joined: Jan 26, 2007
Posts: 74
Probably you can try

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

Joined: Jan 10, 2002
Posts: 63837

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.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: "Window scope"
jQuery in Action, 3rd edition