2012/5/31 J. Garcia <[email protected]>:
> The short-circuiting option sounds good. There could even be a specially
> dedicated getText() (or alternative method name) for this scenario, which
> should be rather frequent in l10n apps.
Not the best solution, but works:
<s:textfield key="user.born" value="%{getFormatted('format.number',
'user.born', {user.born})}" />
and in ExampleAction (or any other base action class):
public String getFormatted(String key, String defaultValue, List<?> args) {
TextProviderFactory tpf = new TextProviderFactory();
if (container != null) {
container.inject(tpf);
}
TextProvider tp = tpf.createInstance(getClass(), this);
if (getFieldErrors().isEmpty()) {
return tp.getText(key, args);
} else {
return
ActionContext.getContext().getValueStack().findString(defaultValue);
}
}
Regards
--
Łukasz
mobile +48 606 323 122 http://www.lenart.org.pl/
Warszawa JUG conference - Confitura http://confitura.pl/
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]