Is it possible to configure unified format of date format for whole struts webapp?

前端 未结 1 433
庸人自扰
庸人自扰 2020-12-12 06:20

In any case id get exception Could not parse date.

There is unified company standard of date format - \'dd/MM/yyyy\'

There are comp

相关标签:
1条回答
  • 2020-12-12 07:13

    Struts2 is designed to behave differently according to a locale requested by the client.

    i18n interceptor is a member of the default interceptor stack. So, it is responsible for setting requested locale to the action context, overriding the default settings. It also stores that locale to the session for further retrieving it if the locale is not requested by the request parameter.

    The action context's locale is used by the default type converter, so setting a locale to the action context should probably override the default locale setting which could be configured via struts.locale and i18n interceptor doesn't change this.

    If so, no other actions required, just put your date format to the global resource properties according to that locale. You can also use action properties that could be used with i18n requested locale that has different format due to the order of processing localization resources.

    If you don't need that possibility of switching a locale by the user you should remove i18n interceptor from the stack.

    How to format the dates and numbers using action context's locale: Formatting Dates and Numbers.

    0 讨论(0)
提交回复
热议问题