Hi,
I want to use the setPrefix(String prefix) method of DefaultMessageCodesResolver to set a different prefix when each of my different forms is being validated.
Where do I get the instance of DefaultMessageCodesResolver from?
I have tried getting it in my form handler like so:
But this throws a Null pointer exception (presumably because the MessageCodesResolver has not been instanciated at this point).Code:protected void onBindAndValidate(HttpServletRequest request, Object command, BindException errors) throws Exception { DefaultMessageCodesResolver resolver = (DefaultMessageCodesResolver) this.getMessageCodesResolver(); resolver.setPrefix("editProduct."); }
Any help would be greatly appreciated.
Thanks.


Reply With Quote
