struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Prasanth <dbad...@pangburngroup.com>
Subject Re: Struts2 Checkboxlist
Date Sat, 02 Feb 2019 03:55:13 GMT
The data class holding the array is in session, done using the scope interceptor.

Thanks
Prasanth

On February 1, 2019 9:30:30 PM CST, Arjuna Bandara <arjunabndr@gmail.com> wrote:
>Hi,
>
>As I understand, you need to modify previous Array before saving.
>
>Have you tried Session variable ?
>
>Regards
>
>Arjuna
>
>On Sat, 2 Feb 2019 3:18 am Prasanth, <dbadmin@pangburngroup.com> wrote:
>
>> Hi,
>>
>> I am using a checkboxlist on a jsp page which corresponds to a
>ArrayList
>> in the form class, which is used to store form data from a multi page
>> wizard. I am using scope interceptor to store the form
>> class in session so that the data persists as the user navigates the
>> wizard. When the user selects some check boxes it is correctly
>populated in
>> the form class but if the user navigates back in the
>> wizard and unchecks the check box (non of the check boxes selected)
>struts
>> doesn't set the ArrayList to empty. It will still contain the old
>> selection. What is the best way to solve this issue?
>>
>> My Options:
>> 1. Should I use Preparable and set this ArrayList to empty? Since
>this is
>> a wizard (multiple pages submitting to the same action) have to make
>sure
>> it is done only when submitting the page that have
>> these checkboxes.
>> 2. Create two separate ArrayLists, one to get values from Struts and
>> another to save the original selection and clear the first array
>list. Down
>> side is I need to populate the list linked to the form
>> when user navigates back to that page.
>>
>> Neither of them seem elegant. Is there a way to make struts set the
>> ArrayList to empty when user doesn't select any check box?
>>
>> Using Struts 2.3.35
>>
>> Thanks,
>> Prasanth
>>

Mime
  • Unnamed multipart/alternative (inline, 7-Bit, 0 bytes)
View raw message