Java Mailing List Archive

http://www.gg3721.com/

Home » Struts Users Mailing List »

Type-specific application-scoped error messages for standard
conversion

Antonio S.

2010-07-07


Author LoginPost Reply
Hello all.

Can I declare application-scoped error messages for standard conversion
that are specific to the type being converted? Something like: "For all
int conversion erros in the whole application use message 'foo'; for all
date conversion errors in the whole application use message 'bar'; and
so forth..."

Actually, it would be ideal if I could reuse the same error messages in
validation configuration, but conversion happens before validation and I
can't use validation mechanism because errors would be detected at
conversion time.

If, for instance, an int conversion fails, I wouldn't like to return a
generic "Invalid field" message, but something more informative like "A
number was expected" or the like.

Using "invalid.fieldvalue.<FIELDNAME>" in a resource bundle involves
using always the same name for the field with a specific type, or repeat
the message in every action.

Overriding "xwork.default.invalid.fieldvalue" only permits a generic
message for all types.

I guess the only option remaining is creating custom converters that
override the default framework converters for standard types: int,
Date...

By the way, is is possible such an override of default converters for
standard types?

Thanks for your time.
Antonio.




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 gg3721.com - Jax Systems, LLC, U.S.A.