From user-return-219260-archive-asf-public=cust-asf.ponee.io@struts.apache.org Tue Feb 5 20:59:52 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 4279C180608 for ; Tue, 5 Feb 2019 21:59:52 +0100 (CET) Received: (qmail 67761 invoked by uid 500); 5 Feb 2019 20:59:51 -0000 Mailing-List: contact user-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list user@struts.apache.org Received: (qmail 67746 invoked by uid 99); 5 Feb 2019 20:59:50 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Feb 2019 20:59:50 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id E2D11CCE75 for ; Tue, 5 Feb 2019 20:59:49 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.999 X-Spam-Level: * X-Spam-Status: No, score=1.999 tagged_above=-999 required=6.31 tests=[HTML_MESSAGE=2, SPF_PASS=-0.001] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id FLMbeCFIVHxP for ; Tue, 5 Feb 2019 20:59:44 +0000 (UTC) Received: from mail.nqadmin.com (mail.nqadmin.com [12.230.133.169]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 5C8DC5F2B1 for ; Tue, 5 Feb 2019 20:59:44 +0000 (UTC) Received: (from root@localhost) by mail.nqadmin.com (8.14.7/8.14.7) id x15KxgO3013417 for user@struts.apache.org; Tue, 5 Feb 2019 14:59:42 -0600 Received: from ppasalalinux.nqadmin.com (ppasalalinux.nqadmin.com [192.168.0.234]) by mail.nqadmin.com with SMTP id f9nmdk25mir3cmrhircize922w; for user@struts.apache.org; Tue, 05 Feb 2019 14:59:42 -0600 (CST) (envelope-from ppasala@pangburngroup.com) Subject: Re: Struts2 Checkboxlist To: user@struts.apache.org References: <020c1e18-efc8-1937-c6a9-a5c1856ca5ca@pangburngroup.com> <1118c62a-e344-8e30-bc8a-0666cd71f42d@pangburngroup.com> From: Prasanth Pasala Organization: The Pangburn Company Message-ID: <599db287-e9db-44de-e26e-21106de8aa64@pangburngroup.com> Date: Tue, 5 Feb 2019 14:59:42 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------9DD48F4AE27D2C8DA88F6022" Content-Language: en-US --------------9DD48F4AE27D2C8DA88F6022 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi Yasser, Even after having the param the ArrayList was not populated with -1 for unchecked checkboxes. The ArrayList is in form. The set method in the form is not getting called when I don't check any of the checkboxes. I am using a checkboxlist rather than individual checkboxes.                                             form                                                    -1             Thanks, Prasanth On 2/5/19 5:43 AM, Yasser Zamani wrote: > Hi Prasanth, > > Yes, I think. Now I can recall a long discussion about this at [1]. i.e. you also can keep array list of long but override the interceptor like below [2]: > > > > -1 > > > Kind Regards. > > [1] https://github.com/apache/struts/pull/169 > [2] https://github.com/apache/struts/pull/169#issuecomment-352999309 > > >> -----Original Message----- >> From: Prasanth Pasala >> Sent: Tuesday, February 5, 2019 3:26 AM >> To: user@struts.apache.org >> Subject: Re: Struts2 Checkboxlist >> >> I am using the defaultStack but the ArrayList used for the checkboxes is of type >> Long. If we change it to ArrayList of Boolean would the interceptor set the values >> to false? Or is this only applicable if you have individual checkboxes rather than >> checkboxlist? >> >> Thanks, >> Prasanth >> >> On 2/4/19 4:29 PM, Paul Zepernick wrote: >>> Yes, setFoo is only called if the checkbox is checked. However, >>> Struts 2 does have a checkbox interceptor: >>> https://struts.apache.org/core-developers/checkbox-interceptor.html >>> >>> This interceptor defaults checkbox Boolean's to False if the box is not checked. >> This is part of the default interceptor stack. >>> Paul >>> >>> -----Original Message----- >>> From: Prasanth Pasala >>> Sent: Monday, February 4, 2019 5:21 PM >>> To: user@struts.apache.org >>> Subject: Re: Struts2 Checkboxlist >>> >>> NOTICE: This email originated from outside of the organization. Do not click >> links or open attachments unless you recognize the sender and know the content >> is safe. >>> Is that how Struts2 is expected to work? Meaning setFoo would not be called if >> non of the Foo checkboxes are selected? I know that is how Struts1 worked. >>> Thanks, >>> Prasanth >>> >>> On 2/2/19 7:08 PM, Prasanth Pasala wrote: >>>> Hi Yasser, >>>> >>>> When none of the checkboxes is selected the setFoo is not getting called. >>>> >>>> Thanks >>>> Prasanth >>>> >>>> On February 2, 2019 8:02:07 AM CST, Yasser Zamani >> wrote: >>>>> Hi Prasanth, >>>>> >>>>> AFAIK this tag is like this: >>>>> >>>>> >>>>> >>>>> It calls getBar method of your action or finds bar in value stack to >>>>> find out what to display. Same for baz to find out which to be >>>>> selected. Then it calls yourAction.setFoo to post selected items. i.e. >>>>> it is up to you what you do with it in setFoo method. Normally you >>>>> should clear baz and fill it with them again to update selected items. >>>>> >>>>> Thanks for using Struts! >>>>> >>>>> Kind Regards. >>>>> >>>>>> -----Original Message----- >>>>>> From: Prasanth >>>>>> Sent: Saturday, February 2, 2019 1:08 AM >>>>>> To: user@struts.apache.org >>>>>> Subject: Struts2 Checkboxlist >>>>>> >>>>>> 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 >>>>> -------------------------------------------------------------------- >>>>> - >>>>> To unsubscribe, e-m >>> Disclaimer: This communication and any files transmitted with it may contain >> information that is privileged, confidential and/or exempt from disclosure under >> applicable law. If you are not the intended recipient, you are hereby notified that >> any disclosure, copying, distribution, or use of the information contained herein >> (including any reliance thereon) is strictly prohibited. If you received this >> communication in error, please immediately contact the sender and destroy the >> material in its entirety, whether in electronic or hard copy format. Thank you. >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org >>> For additional commands, e-mail: user-help@struts.apache.org >>> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org > For additional commands, e-mail: user-help@struts.apache.org > --------------9DD48F4AE27D2C8DA88F6022--