I thought once I store an attribute into the 'request' object, it will be available no matter how many times I iterate through the same Action class? If it doesn't do that, then how do I store data into the request object so I can use it again later in the same Action class or even in a different Action class. Thx.
-----Original Message----- From: Andrew Hill [mailto:[EMAIL PROTECTED] Sent: Thursday, July 17, 2003 12:06 AM To: Struts Users Mailing List Subject: RE: Request object Null Pointer Well of course its null. The second time through you arent calling request.setAttribute("vehList",vehList) before calling prepareListForUpdate() -----Original Message----- From: Au-Yeung, Stella H [mailto:[EMAIL PROTECTED] Sent: Thursday, 17 July 2003 10:52 To: '[EMAIL PROTECTED]' Subject: Request object Null Pointer Hi: I am getting a NULL pointer with the request object: Please see code below. I got a NULL pointer trying to access "vehList' in the request object inside the method "prepareListForUpdate". But I didn't get a NULL pointer accessing "vehList" inside the method "setScheduleList". So it looks like the 1st time it ran through the Action class, the request object is ther. But the 2nd time it ran through the Action class, either the request object is null or "vehList' is no longer in the request object. =============================== Portion of Action class: ArrayList vehList = new ArrayList(); ==> initialize and set values for vehList here <==== if (formBean.isSearchAction()) // user clicks 'search' on form. Run through this Action class the 1st time { request.setAttribute("vehList",vehList); this.setScheduleList(request); // invoke another method <=== eventually "first.jsp" with an 'Update" button is displayed } else if (formBean.isBlnUpdateAction()) // user clicks 'update' in "first.jsp", Run through this Action class the 2nd time { this.prepareListForUpdate(request); // invoke another method } ============================= Portion of method "setScheduleList": setScheduleList(javax.servlet.http.HttpServletRequest request) { // display vehList.size() AND IT PRINTED OUT OK ArrayList l = (ArrayList) request.getAttribute("vehList"); EtLog.debug(this,"in setScheduleList, vehList,size()="+l.size()); } ================================== Portion of method "prepareListForUpdate": prepareListForUpdate(javax.servlet.http.HttpServletRequest request) { // display vehList.size() AND IT GAVE ME A NULL POINTER EXCEPTION ArrayList l = (ArrayList) request.getAttribute("vehList"); EtLog.debug(this,"in prepareListForUpdate, vehList,size()="+l.size()); } ==================================== Any help will be appreciated, Newbie --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

