Return-Path: Delivered-To: apmail-struts-user-archive@www.apache.org Received: (qmail 75410 invoked from network); 6 Dec 2004 16:00:01 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 6 Dec 2004 16:00:01 -0000 Received: (qmail 17777 invoked by uid 500); 6 Dec 2004 15:59:10 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 17508 invoked by uid 500); 6 Dec 2004 15:59:06 -0000 Mailing-List: contact user-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: 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 17465 invoked by uid 99); 6 Dec 2004 15:59:05 -0000 X-ASF-Spam-Status: No, hits=0.1 required=10.0 tests=FORGED_RCVD_HELO,LINES_OF_YELLING X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from Unknown (HELO pubnet.adsoft.com) (195.224.58.178) by apache.org (qpsmtpd/0.28) with ESMTP; Mon, 06 Dec 2004 07:59:00 -0800 Received: from oprig-1.internal.oprig.com (oprig.internal.adsoft.com [192.168.5.252]) by pubnet.adsoft.com (8.12.8/8.12.8) with ESMTP id iB6Fw1Q7027624 for ; Mon, 6 Dec 2004 15:58:01 GMT Received: by oprig.internal.adsoft.com with Internet Mail Service (5.5.2653.19) id ; Mon, 6 Dec 2004 16:05:15 -0000 Message-ID: <84B556CAD2159C4BA8DAA1E37050B5082892F6@oprig.internal.adsoft.com> From: Huw Richards To: Struts Users Mailing List Subject: RE: i18n input Date: Mon, 6 Dec 2004 16:05:15 -0000 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain X-Spam-Status: No, hits=-4.9 required=5.0 tests=BAYES_00 autolearn=ham version=2.63 X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) X-Scanned-By: MIMEDefang 2.43 X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N So does your translation code handle user input errors, like a number/date in wrong format or does it make a "best guess"? Do you keep your translations.xml file upto date by hand or use ant to generate at build time? My app has hundreds of forms with multiple date/number fields. I hadn't thought of extending the html:input & bean:write tags to include a locale for formatting. Great idea! I convert the BigDecimals into a locale formatted String for html:input and use the formatKey variable of bean:write for display. -----Original Message----- From: Simon Matic Langford [mailto:simon.langford@pcmsgroup.com] Sent: Monday, December 06, 2004 7:03 AM To: 'Struts Users Mailing List' Subject: RE: i18n input ___________________________________________________________ *** WARNING *** This email has been received from the internet. Check any attachments for viruses before opening them. ___________________________________________________________ hmm, that's what I've been trying to avoid. I went for a somewhat sicker route :-) I extended the request processor, so it called a new method called processTranslate() just after the validator is called! This then does exactly the same as the population of the form beans, but calls a translation routine to convert from the locale specific format to the system format which is english (a la BigDecimal). This seems to work fine, but means there is a separate xml file to keep up to date, this looks like: I've also extended the html:text and bean:write tags to translate back the other way, which uses the same translation utility. I gather that FormDef does most of this already, but we can't use it unfortunately... Does anyone think this code is useful generally? Simon The information contained in this e-mail is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. If You are not the intended recipient of this e-mail, the use of this information or any disclosure, copying or distribution is Prohibited and may be unlawful. If you received this in error, please contact the sender and delete the material from any computer. The views expressed in this e-mail may not necessarily be the views of The PCMS Group plc and should not be taken as authority to carry out any instruction contained. > -----Original Message----- > From: Huw Richards [mailto:huw.richards@oprig.com] > Sent: 06 December 2004 11:55 > To: Struts Users Mailing List > Subject: RE: i18n input > > > Hi > > It was something along those lines. > > My business objects tend to have convert methods where I take > the strings of > the value object (which have been created in the Action from > the form) and > turn them into their correct types. I have a NumberUtil class > which I use > for converting locale specific strings into BigDecimal. This > NumberUtil > class has a static method which takes a String and a Locale > as parameters > and returns a BigDecimal. > > Huw > > -----Original Message----- > From: Simon Matic Langford [mailto:simon.langford@pcmsgroup.com] > Sent: Monday, December 06, 2004 5:05 AM > To: 'Struts Users Mailing List' > Subject: RE: i18n input > > > > ___________________________________________________________ > > *** WARNING *** > > This email has been received from the internet. > Check any attachments for viruses before opening them. > ___________________________________________________________ > > > huw, > > how did you handle this input on the server side? did you have some > cunning scheme > or just a lot of > NumberFormat.getNumberInstance(request.getLocale()).parse(form > Bean.getFi > eld())? > > thanks > > simon > > > > -----Original Message----- > > From: Huw Richards [mailto:huw.richards@oprig.com] > > Sent: 03 December 2004 23:05 > > To: Struts Users Mailing List > > Subject: RE: i18n input > > > > > > The one problem I had with i18n input was with European > > locales where "," is > > used as the decimal separator. The number would be formatted > > with "," as the > > decimal separator but as the input boxes are just text, the > > numeric keypad > > which produces "," in excel when "." is pressed just produces > > "." in the > > number box. I had to rely on an adapted javascript to mask > > the numbers on > > field entry & exit. > > > > -----Original Message----- > > From: Jim Barrows [mailto:jbarrows@sssc.com] > > Sent: Friday, December 03, 2004 11:00 AM > > To: Struts Users Mailing List > > Subject: RE: i18n input > > > > > > > > ___________________________________________________________ > > > > *** WARNING *** > > > > This email has been received from the internet. > > Check any attachments for viruses before opening them. > > ___________________________________________________________ > > > > > > > > > > > -----Original Message----- > > > From: Simon Matic Langford [mailto:simon.langford@pcmsgroup.com] > > > Sent: Friday, December 03, 2004 8:51 AM > > > To: 'Struts Users Mailing List' > > > Subject: RE: i18n input > > > > > > > > > yeah, I know I can do this, but this is a large system with > > around 200 > > > jsps 80 views > > > and a number of controllers. doing the display is > > reasonably simple I > > > know, but extremely > > > tedious and prone to errors, I was hoping for a more > > elegant solution > > > which also handles > > > input... > > > > I believe it does handle input as well... depending on the > > browser, which > > java has no control over. > > > > > > > > > > Java comes with i18n built in. You want the JSTL > > > for output and look at the way message resources are handled > > > > in struts, as well as read through the i18n documentation on > > > > the sun site. > > > > > > > > > > > > --------------------------------------------------------------------- > > > 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 > > > > > > ___________________________________________________________ > > > > CONFIDENTIALITY NOTE > > > > This message may contain confidential and privileged information. > > If you think, for any reason, that this message may have been > > addressed to you in error, you must not disseminate, copy or > > take any action in reliance on it and we would ask you to notify us > > immediately by return email to "postmaster@oprig.com". > > > http://www.oprig.com > > > --------------------------------------------------------------------- > 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 > > > ___________________________________________________________ > > CONFIDENTIALITY NOTE > > This message may contain confidential and privileged information. > If you think, for any reason, that this message may have been > addressed to you in error, you must not disseminate, copy or > take any action in reliance on it and we would ask you to notify us > immediately by return email to "postmaster@oprig.com". > http://www.oprig.com --------------------------------------------------------------------- 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 ___________________________________________________________ CONFIDENTIALITY NOTE This message may contain confidential and privileged information. If you think, for any reason, that this message may have been addressed to you in error, you must not disseminate, copy or take any action in reliance on it and we would ask you to notify us immediately by return email to "postmaster@oprig.com". http://www.oprig.com --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@struts.apache.org For additional commands, e-mail: user-help@struts.apache.org