This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes How to maintain the old focus after page reload? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to maintain the old focus after page reload?" Watch "How to maintain the old focus after page reload?" New topic
Author

How to maintain the old focus after page reload?

sivaprasad adusumalli
Greenhorn

Joined: Jun 12, 2008
Posts: 2
Hi ,

In my screen i have a table. Table has 8 columns and several rows. In 8 columns, one of the column value has link is there for open the popup. when i am going to select the link to open the popup the entire row will be heighlighted ( means it shows in gray color). After updations done in popup, popup page will close and comeback to the previous page i.e in table page and that table page will be reloaded and updations will be showing. but the problem is prevoius focus (i.e previous heighlighted color gray) is not maintaining. So, what is problem? can any body give the solution?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60077
    
  65

Originally posted by sivaprasad adusumalli:
So, what is problem?
Well, of course if a page is reloaded it's going to revert to its initial state. If you've changed client-side state and need to recreate that state, then you need to remember the state somehow and restore it on page load. You could do that in a server-side session or perhaps cookies, or by passing hidden inputs around.

P.S. "updations" is not a word. The correct word is "updates".


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
sivaprasad adusumalli
Greenhorn

Joined: Jun 12, 2008
Posts: 2
Can you give some example on that?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60077
    
  65

Not really. It could be fairly involved.

And you can restore the state on the server using JSP (or other templating mechanism) before the page even gets sent to the borwoser, or on the client at page load.

If all you need to remember is which row to "focus" then you could use a hidden input that's part of a form submission, or a cookie, or even the hash suffix of the URL.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to maintain the old focus after page reload?
 
Similar Threads
Window.opener problem
Two focused window at the same time
history.back() not retaining changed values in previous page after window.open() call
JTable Problem
focus of JPanel