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

Refresh issue

Sithu Sarath

Joined: Dec 06, 2011
Posts: 1

In my requirement, i have a datagrid which includes an icon in every row in PAGE 1. At one point the icon is purple and then after double clicking the row, it takes to a different page PAGE 2 and after saving, it comes back to PAGE 1. At that time, icon in PAGE 1 has to change to blue. But the icon remains purple in my case. When I refresh the page, the problem is rectified. As i have observed that the icon value taken is that of blue but the display is incorrect, i feel it has something to do with refreshing the page.
Please help me resolve this issue as soon as possible.

Deepak Bala

Joined: Feb 24, 2006
Posts: 6662

How is the color updated ? By modifying the page's innerHTML ?

From the work flow you mentioned, it appears to me that your page is displayed based on a flag that is set by the controller. Obviously the JSP will not contain the updated flag unless it is refreshed. Two solutions you can try

1. Use AJAX to poll the status of this flag and display the result. This is inefficient and has a time delay.
2. Modify the flow so that the new page does not open in a new window, but on the same window. When you are done with your changes the page should redirect to the old page, which would result in another GET call to the controller. The JSP page will now contain updated values.

I assumed that some of the calls that you make are idempotent. If they are not you may need to use a pattern like PRG to get around problems related to usability.

SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
I agree. Here's the link:
subject: Refresh issue
It's not a secret anymore!