<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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]