Return-Path: Delivered-To: apmail-struts-user-archive@www.apache.org Received: (qmail 35158 invoked from network); 9 Nov 2005 05:11:14 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 9 Nov 2005 05:11:14 -0000 Received: (qmail 43958 invoked by uid 500); 9 Nov 2005 05:11:02 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 43939 invoked by uid 500); 9 Nov 2005 05:11:01 -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 43917 invoked by uid 99); 9 Nov 2005 05:11:01 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Nov 2005 21:11:01 -0800 X-ASF-Spam-Status: No, hits=1.3 required=10.0 tests=RCVD_IN_BL_SPAMCOP_NET,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of hrabago@gmail.com designates 66.249.82.203 as permitted sender) Received: from [66.249.82.203] (HELO xproxy.gmail.com) (66.249.82.203) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Nov 2005 21:10:54 -0800 Received: by xproxy.gmail.com with SMTP id t15so82506wxc for ; Tue, 08 Nov 2005 21:10:39 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=fu/q9gkYanh9mePB/on73mWjRsJOIRTzzo4ra77bg+uUtVg7QRzd+trY0uZ34G3tM26rPn/aW1joSadlzZdyElbIM1QDua1Vs/lDjlsrXoC+jzpTkZhPWAJcSojINk+XJx1/dn6eNMMjjgQGE0xvf+rpKmZjF4A7fxxpsxtxbFo= Received: by 10.64.241.4 with SMTP id o4mr364244qbh; Tue, 08 Nov 2005 21:10:39 -0800 (PST) Received: by 10.64.150.13 with HTTP; Tue, 8 Nov 2005 21:10:39 -0800 (PST) Message-ID: <7b809eef0511082110i23b27c71t24a2b9ec598d8854@mail.gmail.com> Date: Tue, 8 Nov 2005 23:10:39 -0600 From: Hubert Rabago To: Struts Users Mailing List Subject: Re: java.util.Date in Action Form Bean In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <98432.1130555421886.JavaMail.?@fh058.dia.cp.net> <7b809eef0511020757p20d758c2seabc6ea1d828fd40@mail.gmail.com> <7b809eef0511021239g5d78020ck830890bffe9ce06e@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N On 11/8/05, Yujun Liang wrote: > in Struts, you can define > > > > > and you can just call, > > bean =3D ((DynaActionForm) form).get(pageName); > in this case pageName =3D "instruction"; > > and Struts automatically populate a > com.clear2pay.bph.bean.Instructionobject in the form, I feel I have to explain something about Struts form beans. It is not recommended that you use fields other than String and boolean in your form beans. The form bean is where the request parameters are stored before your fields are even validated. If validation fails, you'd ideally want to preserve what the user typed in so s/he can correct his/her input. For instance, if the user typed in "1q3" in field that's meant to hold a numeric value, the field will be marked invalid and the form will be shown to the user again. If the form bean used a String for this property, the user will see the "1q3" value on the input control. If the form bean used an int for the property, the attempt to populate that field with "1q3" would fail and the user would see "0" instead.=20 The same thing applies to date fields. I don't even know what will happen if the user typed in "35 Se[ 2005" on a field that's declared as java.util.Date. The best approach is to use String fields, so the user's input is preserved, and in the case of user errors, they will be able to edit the values they typed in instead of starting over again. Of course, each application has its own set of circumstances, so this may not be an issue for you. If you're still interested in checking out FormDef, though, take a look at http://www.rabago.net/struts/formdef/dev/nested.htm . This page describes FormDef's support for nested beans with the latest dev builds.. Hubert --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@struts.apache.org For additional commands, e-mail: user-help@struts.apache.org