Hi, I'm having a bug in my application that the user's session attribute SOMETIMES does not get updated/refreshed as expected, but I don't know the reason why. Please advise what I'm doing wrong. Here is my test scenario
1) UserAction class fetches a list of employees with review status and store the list in an ArrayList 2) UserAction class set this ArrayList object in a session attribute 3) UserAction class forwards to a view 4) A view uses above ArrayList object in session to display a list of employees with their review status (reject/approve) 5) The user selects one or more employees and submit for approval or/and rejection 6) UserAction class saves the employee(s) review status 7) UserAction class rebuilds the ArrayList by fetching from a database 8) same as step 2 9) same as step 3 10) same as step 4 I debugged the code and I found that the data get saved correctly in step 6 and returned with updated values in step 7. But, SOMETIMES that data in a session attribute does not get updated. If I refresh browser window, it displays the new updated data. Here's my code snippet ####### UserAction class ########## . . . // get a list of employees. Returns an array list of EmployeeVO objects List employeeList = employeeDAO.getEmployeeReviewList( manager.getEmployeeId() ); // make sure to destroy previous employeeList object before setting a new one List tmpObj = (List)session.getAttribute( USER_EMPLOYEE_LIST_VIEW_KEY ); tmpObj = null; // now set the object in a session attributes session.setAttribute( USER_EMPLOYEE_LIST_VIEW_KEY, employeeList ); . . . ######## Value Object ########### /** * The Value Object will be placed in the session; therefore it needs to be * serializable so the container can persist sessions if needed. */ public class EmployeeVO extends PersonVO implements Serializable { . . . } ######## JSP View ############ <jsp:useBean id="employeeList" scope="session" class="java.util.ArrayList" /> <% // number of employees returned from the list if ( employeeList != null ) { int listSize = employeeList.size(); } %> <html:html locale="true"> <head> <html:base/> <title><bean:message key="app.label.title" /></title> <link rel="stylesheet" type="text/css" href="common/styles/styleMid.css"> <script language="javaScript"> <%@ include file="CommonJSFunctions.js"%> </script> </head> <body> <html:form action="/approveSubmit" name="approveSubmitForm" type="com.phs.ezhr.presentation.form.ApproveSubmitForm" method="POST" target="_parent"> <tabe> <logic:present name="employeeList" scope="session"> <!-- Iterate over the results of the query. Max of 25 records per page --> <logic:iterate id="employee" name="employeeList" scope="session" type="com.phs.ezhr.business.vo.EmployeeVO" indexId="idx" length="25" offset="<%= ""+count %>"> // ------------------------------------------------------------------ // output employee data with review status here. // I'm using JSP scripting instead of <bean:write> tag // Could this have any conflicts?????? Below is a sample code // ------------------------------------------------------------------ <tr> <td><%= employee.getReviewStatus() %></td> </tr> </logic:iterate> </logic:present> </table> </html:form> </body> </html:html>
<<winmail.dat>>
-- To unsubscribe, e-mail: <mailto:struts-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>