struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Laurie Harper <lau...@holoweb.net>
Subject Re: Some i18n issues
Date Wed, 14 Sep 2005 19:50:20 GMT
Michael Ewers wrote:
> Can anyone see a reason why the html:text implementation in struts-html.tld
> doesn't support a formatKey attribute?

I guess because there are already ways to format values which can be 
composed with <html:text/> so it doesn't *need* to support it. If 
there's some reason that approach wont work in some situation or other, 
or if you feel strongly that the convenience of adding formatKey to 
<html:text/> and/or other tags outweighs the API bloat, you can submit 
an enhancement request, though.

> To whom can I send patches that I write?

The best way is to open a ticket in Bugzilla and attach patches there. 
Posting to / nagging on the dev list is the best way to get the patches 
looked at and would be the best place to ask whether such patches are 
likely to be accepted.

L.

> 
> Thanks,
> Michael.
> 
> 
>>That doesn't allow the use of the Struts HTML tags though, since you 
>>can't use a tag in a tag attribute... This will work, though:
>>
>>   <html:text name="...">
>>     <jsp:attribute name="value">
>>       <bean:write name="productForm" property="listprice"
>>                   formatKey="format.number"/>
>>     </jsp:attribute>
>>   </html:text>
>>
>>A little cumbersome, and not the only way. You can also do it without a 
>>nested <jsp:attribute/> if you don't mind creating a scripting variable.
>>
>>L.
>>
>>Ivan Rodriguez wrote:
>>
>>><input type="text" name="productForm.listprice" value="<bean:write 
>>>name="productForm" property="listprice" formatKey="format.number" />">
>>>
>>>
>>>Michael Ewers escribió:
>>>
>>>
>>>>The problem is that the <html:text> tag doesn't have a 
>>>>formatKey-attribute
>>>>and I want the initial value to be displayed in a text-field, not as a 
>>>>pure
>>>>html-output.
>>>>In other words: I need struts to make a "<input type="text"
>>>>name="propertyName" value="1000,00">" out of a "...initial="1000" with
>>>>German locale set in browser.
>>>>
>>>>Thans,
>>>>Michael.
>>>>
>>>> 
>>>>
>>>>
>>>>>You have to use an initial value of "1000".
>>>>>
>>>>><form-bean name="productForm"
>>>>>    type="org.apache.struts.validator.DynaValidatorForm">
>>>>>    ....
>>>>>    <form-property name="listprice" type="java.lang.String"
>>>>>initial="1000"
>>>>>/>
>>>>></form-bean>
>>>>>
>>>>>
>>>>>
>>>>>Then where you print this initial value, at your jsp, use formatting 
>>>>>options:
>>>>>
>>>>><bean:write name="productForm" property="listprice" 
>>>>>formatKey="format.number" />
>>>>>
>>>>>format.number is an entry in you MessageResources.properties
>>>>>
>>>>>For german MessageResources_de.properties:
>>>>>format.number=#0.000,00
>>>>>
>>>>>For english MessageResources_en.properties:
>>>>>format.number=#0,000.00
>>>>>
>>>>>
>>>>>Michael Ewers escribió:
>>>>>
>>>>>  
>>>>>
>>>>>
>>>>>>Hi,
>>>>>>
>>>>>>I'm new to this group so first of all I'm pleased to have the 
>>>>>>opportunity
>>>>>>    
>>>>>
>>>>>to
>>>>>  
>>>>>
>>>>>
>>>>>>ask questions here.
>>>>>>
>>>>>>My question(s):
>>>>>>1) I'm trying to write an application that supports i18n with Struts.
>>
>>I
>>
>>>>>>    
>>>>>
>>>>>use
>>>>>  
>>>>>
>>>>>
>>>>>>DynaActionForm for my forms, so I defined them with initial values,

>>>>>>e.g.:
>>>>>><form-bean name="productForm"
>>>>>>   type="org.apache.struts.validator.DynaValidatorForm">
>>>>>>   ....
>>>>>>   <form-property name="listprice" type="java.lang.String"
>>>>>>    
>>>>>
>>>>>initial="1.000"
>>>>>  
>>>>>
>>>>>
>>>>>>/>
>>>>>></form-bean>
>>>>>>I have German and English users. My problem is that it seems to be
>>>>>>impossible to definie initial values for different languages. 
>>>>>>"1.000" in
>>>>>>Germany means 1000, in UK it means 1. For German users the initial

>>>>>>value
>>>>>>should be "1,000".
>>>>>>Is there a solution for this problem?
>>>>>>
>>>>>>2) If I use the Validator framework to validate double form values,

>>>>>>it's
>>>>>>basically the same problem: Validator seems to know English writing

>>>>>>rules
>>>>>>    
>>>>>
>>>>>of
>>>>>  
>>>>>
>>>>>
>>>>>>double values but "1,00" is not a valid double value for Validator,

>>>>>>even
>>>>>>    
>>>>>
>>>>>if
>>>>>  
>>>>>
>>>>>
>>>>>>the browser's Locale is set to German.
>>>>>>Is there a solution?
>>>>>>
>>>>>>Bye,
>>>>>>Michael.
>>>>>>
>>>>>>---------------------------------------------------------------------
>>>>>>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
>>>>>
>>>>>  
>>>>
>>>>
>>>>---------------------------------------------------------------------
>>>>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
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message