struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick" <patrick.her...@ticino.com>
Subject R: RE: i18n of money/date bean properties
Date Tue, 16 Oct 2001 10:55:44 GMT
I find your a very good idea,
Infact I had this morning the same problem.
I looked in the struts documentation and there seems that the
bean:message that should work also with bean's properties (without
key)but I suppose this was something true only in the previous
editions (the name and property attributes are included in the
struts.tld (depracated) but not in the struts-bean.tld (where the key
attribute is mandatory)...
I would suggest to create two differents tags, one for dates
(DateFormatTag) and one for numbers (NumberFormatTag).
In my opinion is not nice to have to insert in an attribute "date" or
"number" and then in the code to switch beetween them...
I created two simple versions of these tags. What do you think about?

Bye
Patrick

---- Original Message ----
Da: pnguin34@hotmail.com
A: struts-user@jakarta.apache.org, 
Oggetto: R: RE: i18n of money/date bean properties
Data: Mon, 15 Oct 2001 20:31:49 -0400

>I'm trying to keep anything related to the view inside the view. I 
>think the 
>output format of the date and money fields should be left to the JSP 
>writer 
>and not the Java programmer. I'm thinking that I should create a new 
>tag 
>like <bean:formattedwrite> or <bean:localewrite> and add a 
>'format-type' 
>attribute and a 'format' attribute. 'format-type' would be either 
>'number' 
>or 'date' and format would be the desired format (e.g., 
>"#,##0.00;(#,##0.00)" for a money field or "MMMM dd, yyyy" or 
>"MEDIUM" for a 
>date field). Depending on the 'format-type' I would use either 
>NumberFormat 
>or SimpleDateFormat and the 'format' to display the bean property, 
>both 
>using the appropriate Locale. The only thing holding me back is that 
>I feel 
>like this should already be there and if it isn't, then maybe it's 
>for a 
>reason. Any comments from anyone?
>
>Dean
>
>>From: "Gavin Terrill" <gterrill@karora.ca>
>>Reply-To: struts-user@jakarta.apache.org
>>To: <struts-user@jakarta.apache.org>
>>Subject: RE: i18n of money/date bean properties
>>Date: Sun, 14 Oct 2001 11:15:16 -0400
>>
>>What about keeping the value of totalCharge as a String in your form
>>object, and formatting it appropriately in your Action using
>>java.text.DecimalFormat?
>>
>>
>>
>>-----Original Message-----
>>From: Dean Drucker [mailto:pnguin34@hotmail.com]
>>Sent: Saturday, October 13, 2001 9:15 PM
>>To: struts-user@jakarta.apache.org
>>Subject: i18n of money/date bean properties
>>
>>
>>I hope this isn't a newbie question, but here goes:
>>
>>I have a bean with a property (totalCharge) of type double. I would 
>like
>>to
>>display this property as localized money. And to make it even 
>harder I
>>need
>>to be able to set the Locale up to use Spanish for text but US$ for
>>currency
>>and US date format. Will bean:write do this for me? I also have 2 
>Date
>>properties in my bean.
>>
>>>From the docs, it appears Struts will convert my property value to a
>>String,
>>probably not what I want. I saw a reference to setting a 
>PropertyEditor
>>on
>>the type to override getAsText() but I don't know how to do that 
>and I'm
>>not
>>sure it would work anyway. I'm thinking I might need to define a new
>>type
>>for the property or create other properties that represent the 
>String
>>versions of the double and Dates. Am I on the right track? 
>Appreciate
>>any
>>help I can get. Thanks!
>>
>>Dean
>>
>>
>>_________________________________________________________________
>>Get your FREE download of MSN Explorer at
>>http://explorer.msn.com/intl.asp
>>
>
>
>_________________________________________________________________
>Get your FREE download of MSN Explorer at 
>http://explorer.msn.com/intl.asp
>
>

Mime
View raw message