Removing bean from session scope

2001-08-29 Thread chiji nwankwo

Hi Andre,
I picked up on something you said in your message yesterday about removing a bean from session scope. I have 2 pages in my application, the first page (archive.jsp) consists of select boxes, which populate each other without having to click on a submit button and the second page (results.jsp) which displays a list of the user's selection, when a link has been clicked. 
After the user has clicked on the link, which takes to them to the results page I want to be able to reset the contents of the form so that if the user clicks on the back button, the contents of the form would have been re-initialized.
Removing the bean from session scope I feel might be the answer to my problem. 
Thanks for your help.
Chiji

From: "Paradis, André" <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED] 
To: <[EMAIL PROTECTED]>
Subject: RE: Validation FW: Displaying messages passed the request 
Date: Tue, 28 Aug 2001 14:12:00 -0400 
MIME-Version: 1.0 
Received: from [64.125.133.20] by hotmail.com (3.2) with ESMTP id MHotMailBD552B5A000640042A1A407D85140FDB0; Tue, 28 Aug 2001 11:18:02 -0700 
Received: (qmail 31125 invoked by uid 500); 28 Aug 2001 18:10:05 - 
Received: (qmail 31115 invoked from network); 28 Aug 2001 18:10:05 - 
Received: from unknown (HELO srvexc1.versalys.com) (206.162.152.15) by daedalus.apache.org with SMTP; 28 Aug 2001 18:10:05 - 
From struts-user-return-16203-cn081 Tue, 28 Aug 2001 11:18:32 -0700 
Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm 
Precedence: bulk 
list-help: 
list-unsubscribe: 
list-post: 
Delivered-To: mailing list [EMAIL PROTECTED] 
content-class: urn:content-classes:message 
X-MimeOLE: Produced By Microsoft Exchange V6.0.4712.0 
Message-ID: [EMAIL PROTECTED] 
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
Thread-Topic: Validation FW: Displaying messages passed the request 
Thread-Index: AcEv605KurbJYeuOSwuc1jYIkl+krwAANFUQ 
X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N 
 
Matt, 
 
Doing a redirection causes a new request to be created, thus you loose 
everything you put in the previous request object. You could save your 
messages in user session scope, then do your redirection. The next page 
will have access to the user session and you'll be able to read those 
messages. After messages are read, you can remove the bean from session 
scope in order preserve memory on the server. 
 
Andre Paradis 
 
-Original Message- 
From: Matt Raible [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, August 28, 2001 2:01 PM 
To: Struts User 
Subject: Validation FW: Displaying messages passed the request 
 
 
I have a SaveAction that sets up some success messages using: 
 
messages.add(new ActionMessage("timesheetManage.save.success")); 
saveMessages(Constants.MESSAGE_KEY, request, messages); 
 
 
And upon this save, the findForward("success") forwards to another 
action class with: 
 
 name="success" 
 path="/do/editTimesheet?action=Edit" redirect="true" / 
 
But on the JSP after, there are no messages displayed. I know the 
answer why, and that is because "redirect=true". However, this is the 
only way I can forward to another action class in iPlanet. 
 
Anyone know of a workaround to carry these messages into the next page? 
Can I check the request in "editTimesheet" to see if messages exist, and 
if so - add them to the request again? 
 
Thanks, 
 
Matt 
 
 
 
 
Get your FREE download of MSN Explorer at http://explorer.msn.com


Re: Removing bean from session scope

2001-08-29 Thread Luis Olivares



What do you mean by 'clicks on the back 
button'?
Is it the browser's back button or a button 
that 'submits' back to the archive.jsp page?

In case it is the browser's back button, your issue 
is related with javascript.
What you see when you click this back button (or 
use in some way 'history.back()' in javascript) is thepage in your 
cache.

If you use a back button of yours with 
'javascript:location.replace("results.jsp");' embedded in his onClick event, you 
force the page to go that locationwithout taking it from 
cache.

Usually form beans have request scope, so I don't 
think your problem is to remove the bean from session.
You should calla actionto return to your archive.jsp page to 
ensurethe page is 'resets' itself.

Anyway, you removea bean this way (I think is 
the same way with form beans, but not sure):

 
session.removeAttribute("beanName");
Regards.



  - Original Message - 
  From: 
  chiji nwankwo 
  
  To: [EMAIL PROTECTED] 
  Sent: Wednesday, August 29, 2001 4:12 
  AM
  Subject: Removing bean from session 
  scope
  
  
  
  Hi Andre,
  I picked up on something you said in your message yesterday about removing 
  a bean from session scope. I have 2 pages in my application, the first 
  page (archive.jsp) consists of select boxes, which populate each other without 
  having to click on a submit button and the second page (results.jsp) which 
  displays a list of the user's selection, when a link has been clicked. 
  
  After the user has clicked on the link, which takes to them to the results 
  page I want to be able to reset the contents of the form so that if the user 
  clicks on the back button, the contents of the form would have been 
  re-initialized.
  Removing the bean from session scope I feel might be the answer to my 
  problem. 
  Thanks for your help.
  Chiji
  
  From: "Paradis, André" <[EMAIL PROTECTED]>
  Reply-To: [EMAIL PROTECTED] 
  To: <[EMAIL PROTECTED]>
  Subject: RE: Validation FW: Displaying messages passed the 
  request 
  Date: Tue, 28 Aug 2001 14:12:00 -0400 
  MIME-Version: 1.0 
  Received: from [64.125.133.20] by hotmail.com (3.2) with ESMTP 
  id MHotMailBD552B5A000640042A1A407D85140FDB0; Tue, 28 Aug 2001 11:18:02 -0700 
  Received: (qmail 31125 invoked by uid 500); 28 Aug 2001 
  18:10:05 - 
  Received: (qmail 31115 invoked from network); 28 Aug 2001 
  18:10:05 - 
  Received: from unknown (HELO srvexc1.versalys.com) 
  (206.162.152.15) by daedalus.apache.org with SMTP; 28 Aug 2001 18:10:05 - 
  From struts-user-return-16203-cn081 Tue, 28 Aug 2001 11:18:32 
  -0700 
  Mailing-List: contact [EMAIL PROTECTED]; run 
  by ezmlm 
  Precedence: bulk 
  list-help: <mailto:[EMAIL PROTECTED]>
  list-unsubscribe: 
  <mailto:[EMAIL PROTECTED]>
  list-post: <mailto:[EMAIL PROTECTED]>
  Delivered-To: mailing list [EMAIL PROTECTED] 
  content-class: urn:content-classes:message 
  X-MimeOLE: Produced By Microsoft Exchange V6.0.4712.0 
  Message-ID: 
  [EMAIL PROTECTED] 
  X-MS-Has-Attach: 
  X-MS-TNEF-Correlator: 
  Thread-Topic: Validation FW: Displaying messages passed the 
  request 
  Thread-Index: AcEv605KurbJYeuOSwuc1jYIkl+krwAANFUQ 
  X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N 
   
  Matt, 
   
  Doing a redirection causes a new request to be created, thus 
  you loose 
  everything you put in the previous request object. You could 
  save your 
  messages in user session scope, then do your redirection. The 
  next page 
  will have access to the user session and you'll be able to read 
  those 
  messages. After messages are read, you can remove the bean from 
  session 
  scope in order preserve memory on the server. 
   
  Andre Paradis 
   
  -Original Message- 
  From: Matt Raible [mailto:[EMAIL PROTECTED]] 
  Sent: Tuesday, August 28, 2001 2:01 PM 
  To: Struts User 
  Subject: Validation FW: Displaying messages passed the request 
   
   
  I have a SaveAction that sets up some success messages using: 
   
  messages.add(new 
  ActionMessage("timesheetManage.save.success")); 
  saveMessages(Constants.MESSAGE_KEY, request, messages); 
   
   
  And upon this save, the findForward("success") forwards to 
  another 
  action class with: 
   
   name="success" 
   path="/do/editTimesheet?action=Edit" redirect="true" / 
   
  But on the JSP after, there are no messages displayed. I know 
  the 
  answer why, and that is because "redirect=true". However, this 
  is the 
  only way I can forward to another action class in iPlanet. 
   
  Anyone know of a workaround to carry these messages into the 
  next page? 
  Can I check the request in "editTimesheet" to see if messages 
  exist, and 
  if so - add them to the request again? 
   
  Thanks, 
   
  Matt 
   
   
   
   
  
  
  Get your FREE download of MSN Explorer at http://explorer.msn.com