Defining Formats
Struts2 supports 1ocalization localization (l10n) aware formatting of dates, times and numbers very easily, utilizing Java's built-in date formatting features.
...
Code Block |
---|
<s:textfield key="orderItem.price" value="%{getText('format.number',{'orderItem.price'})}" /> |
This maps to the method signature getText( String key, Object[] params ) in ActionSupport.
Using getFormatted() with conversion support
A new method getFormatted was added to ActionSupport (which can be implemented in your base action) to support formatting and conversion errors with I10N.
You can place a code like below
Code Block |
---|
<s:textfield key="user.born" value="%{getFormatted('format.number','user.born')}" />
|
to get support for I10N and also to support conversion errors.