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

refreshing html table

Winston Smith
Ranch Hand

Joined: Jun 06, 2003
Posts: 136
Hello Everyone,
The data flow of my web project is as follows:
Time values are read from a database and displayed in an HTML table for the client. Now, when the client clicks <SIGN IN>, a form is submitted to another jsp page for processing, at which point the database is updated with new time values. Now, when I redirect the client back to the original page with the HTML table, it still shows the old values.
I'm using a bean with session scope to access the database and store the values.
i.e. Bean.getTimeValuesFromDB()
If I end the session and start a new one, the HTML table is accurate. It is almost as if, when I redirect back to the original page, the bean is not calling the getTimeValuesFromDB() again.
Thanks for any suggestions,

for (int i = today; i < endOfTime; i++) { code(); }
Ron Newman
Ranch Hand

Joined: Jun 06, 2002
Posts: 1056
You're going to need to show us some code, especially where you're instantiating the bean and where you are calling its getTimeValuesFromDB() method.

Ron Newman - SCJP 1.2 (100%, 7 August 2002)
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 61957

A likely suspect is that your browser is showing a cached version of the page. Search through this and the HTML forum for "cache" and you'll find some techniques to stop active pages from caching.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Winston Smith
Ranch Hand

Joined: Jun 06, 2003
Posts: 136
Thanks for the replies. The following code has been cut down for readability, but all of the relevant functionality is shown:
<jsp:useBean id="Connection" class="timekeeper.DBConnectivity" scope="session" />
<jsp:useBean id="Employee" class="timekeeper.Employee" scope="session" />
<jsp:useBean id="Payperiod" class="timekeeper.Payperiod" scope="session" />
/* This is the bean in question */
<jsp:useBean id="DaySchedule" class="timekeeper.DaySchedule" scope="session" />
<jsp:useBean id="DBDaySchedule" class="timekeeper.DBDaySchedule" scope="session" />
<jsp:useBean id="DBJON" class="timekeeper.DBJON" scope="session" />

/* initialize JDBC aspects of bean */

/* this call to initDayEntries reads database and initializes bean member variables */
DaySchedule.initDayEntriesFromDB(Employee.getId(), new java.sql.Date((Payperiod.getStartDate()).getTime())));

<%-- begin page proper --%>

/* When user clicks SIGN IN, form is submitted to processInOut.jsp */
/* The following script is located in processInOut.jsp to send the user back to the original page */
<SCRIPT language="javaScript">
alert("Click okay to return to schedule");
/* When employeeSchedule.jsp is brought back up, it still has the old values. It seems like a cache problem, like Bear is saying. I'm still working on it...thanks for your attention. */
[ July 24, 2003: Message edited by: Winston Smith ]
Winston Smith
Ranch Hand

Joined: Jun 06, 2003
Posts: 136
At this point, I'm thinking it's possibly a database issue, since I can update bean values in the processInOut.jsp, then redirect back to the employeeSchedule.jsp, and I can see that the bean's values have been updated. I've also confirmed that the functions which access the database are being called and are working correctly. As another check, I've actually looked as the database and confirmed that the values have why does this bean not read the new values? Could jdbc be using some kind of cached version of the original resultSet??? This may explain why it works when opening a new session. Anyhow, thanks for any suggestions.
I agree. Here's the link:
subject: refreshing html table