struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick" <>
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?


---- Original Message ----
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 
>and not the Java programmer. I'm thinking that I should create a new 
>like <bean:formattedwrite> or <bean:localewrite> and add a 
>attribute and a 'format' attribute. 'format-type' would be either 
>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 
>or SimpleDateFormat and the 'format' to display the bean property, 
>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?
>>From: "Gavin Terrill" <>
>>To: <>
>>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
>>-----Original Message-----
>>From: Dean Drucker []
>>Sent: Saturday, October 13, 2001 9:15 PM
>>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 
>>display this property as localized money. And to make it even 
>harder I
>>to be able to set the Locale up to use Spanish for text but US$ for
>>and US date format. Will bean:write do this for me? I also have 2 
>>properties in my bean.
>>>From the docs, it appears Struts will convert my property value to a
>>probably not what I want. I saw a reference to setting a 
>>the type to override getAsText() but I don't know how to do that 
>and I'm
>>sure it would work anyway. I'm thinking I might need to define a new
>>for the property or create other properties that represent the 
>>versions of the double and Dates. Am I on the right track? 
>>help I can get. Thanks!
>>Get your FREE download of MSN Explorer at
>Get your FREE download of MSN Explorer at 

View raw message