struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Antonio S." <inganto...@gmail.com>
Subject Type-specific application-scoped error messages for standard conversion
Date Wed, 07 Jul 2010 10:28:34 GMT
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@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message