开发者

Spring Validator Errors ObjectError

If I have an objectError (of class ObjectError), now when I do **messageResource.g开发者_开发知识库etMessage(objectError,Locale.US);**

How can I get exactly which partucular code(out of all the codes in codes list in objectError) got resolved by the messageSource

Thanks!


Message codes for your ObjectError instances are resolved by an implementation of the interface MessageCodesResolver. The default implementation shipping with the Spring framework is called DefaultMessageCodesResolver and its strategy for generating message codes is well documented in the JavaDocs.

The resulting message codes will be resolved in the given order starting with the most precise message code. If you want to know which one was resolved, you would need to resolve the error codes with the help of the DefaultMessageCodesResolver from your ObjectError and try to resolve the message until you successfully evaluate a given message code to a message.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜