I have made a custom interceptor to display the error messages in my own format. It is successful to an extent.
开发者_如何转开发But i would like to know can we get label of any textfield directly from invocation object?
Thanks in advance
If your field labels are localized, then yes, you can get the label text. Otherwise, no, since they would just be a string literal in the JSP.
Assuming you have a localized property: field.firstName = First Name
You can get that from your interceptor using:
LocalizedTextUtil.findDefaultText(
"field.firstName",
invocation.getInvocationContext().getLocale()
);
However, if you provide more details on what you are trying to do, we may be able to offer better solutions.
精彩评论