开发者

Is it possible to get label of any text field inside any interceptor?

开发者 https://www.devze.com 2023-02-10 13:15 出处:网络
I have made a custom interceptor to display the error messages in my own format. It is successful to an extent.

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.

0

精彩评论

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