remove conversion validation message in struts 2 or make it general

In my struts2 application I have field named carrierNo that accepts integer, when i put string in it gives me this validation error message:

    *Invalid field value for field "carrierNo".*

i can customize this error message in the properties file like this

    invalid.fieldvalue.carrierNo=this field does not accept characters

but i don't want to write a customized message for every non String field in my web application, i want to make it general, i tried the following but it did not work

  invalid.fieldvalue.%{getText(fieldName)}=this field does not accept characters

if there is no way to make general, please help me disable this message at all. then i will use converstion field validator with single message that i define in the properties file.

so my request is to help me make this invalid.fieldvalue.carrierNo general something like this form invalid.fieldvalue.%{getText(fieldName)}

or disable the display of this error message Invalid field value for field "carrierNo".


You could create your own implementation of ConversionErrorInterceptor which finds out the class of failed field and gets your custom message.

Edit: See source code for ConversionErrorInterceptor. For example you could do something like this in your custom interceptor inside intercept method

// get field by name from action
Field f = invocation.getAction().getClass().getDeclaredField(propertyName);
// get type of field
Class clz = f.getType();

String message = LocalizedTextUtil.findDefaultText(XWorkMessages.DEFAULT_INVALID_FIELDVALUE + "." + clz,

And in your file put, xwork.default.invalid.fieldvalue.float, etc.

Need Your Help

Array Item Referring to Another Sibling Element

php arrays object items

Can i do this in PHP, or any others way around ? I want to refer to another element in the array.

How to reflect the increase of width to a div dynamically to opposite direction,after width reaches 0 or below zero?

jquery css css3 html

ok ,i dynamically increase the width of an empty div with css property of opacity 0.5,