struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anand Raman <>
Subject Re: changing scope of the ActionForm objects at runtime
Date Mon, 12 Mar 2001 08:06:04 GMT
Hi Amar
I did something similar..

Whenever i needed a ActionForm for variable scope i always used the
session scope. Now whenever i needed the bean to persist only for the
request, i manully removed the attribute from the session scope.. Not a
very elegant solution, but still managed to solve my needs/..

Hope this helps

On Thu, Mar 08, 2001 at 01:40:12PM -0500, Nanduri, Amarnath wrote:
>Hi all,
>        Is it possible to change the scope of the ActionForm bean during
>runtime ? 
>For example i have a multi-page ActionForm Bean being used by different
>Actions. After the user has filled in all the information in this
>ActionForm, the user submits the information to an other Action Class. This
>Action Class writes the information to a database, then has to show the user
>the information entered by them (so that they can print it for their
>records). After which, the ActionForm gets deleted (or) removed from
>  To do this..i have given the ActionForm bean request scope (in all the
>Actions which handle the user input). When the user submits info, and it
>gets written to a database, i want to change the scope of this ActionForm to
>"request" scope. On doing this the jsp page will show the information back
>to the user, after which the ActionForm Bean gets deleted (since it has
>request scope). 
>  If i set the scope in the 'struts-config.xml' to 'session' for some
>Actions and 'request' to the Action class which writes to database and
>displays a page of all the user-entered information....will it work ?
>   Any comments / suggestions will be greatly appreciated. Thanks.

View raw message