validation - Change Struts Validator default messages -


i new in struts2 . have created xml file validations, when test form don't error messages configured in xml file. instead struts 2 defaults messages such 1 :

invalid field value field "capteur.energie_capteur".

is there anyway make struts2 prints messages configured in xml file instead of default ones ?

that not validation error message, conversion error message.

you can override default conversion error message each single object, creating entry in global .properties file, described in struts 2 documentation, type conversion errors handling:

by default, conversion errors reported using generic i18n key xwork.default.invalid.fieldvalue, can override (the default text invalid field value field "xxx", xxx field name) in global i18n resource bundle.

however, may wish override message on per-field basis. can adding i18n key associated action (action.properties) using pattern invalid.fieldvalue.xxx, xxx field name.

if interested in understanding how works in deeper way, read the short story validation, conversion , friends.


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -