Change fmt:formatDate pattern dynamically

扶醉桌前 提交于 2020-01-15 09:06:30

问题


I need to change fmt:formatDate pattern dynamically depending on the localization. I have the property file for each locale with the date.format key, somewhere it's value is MM/dd/YYYY, somewhere DD/MM/YYYY and so on. In the JSP I have the following tag:

<fmt:formatDate value="${dateToFormat}" pattern="<spring:message code='date.format' />" var="formattedDate" />

The Exception I get is java.lang.IllegalArgumentException: Illegal pattern character 'p' What's wrong with this code?


回答1:


Looks like the pattern is not coming in as you expected. Check to see what the spring message for date.format is.



来源:https://stackoverflow.com/questions/30783272/change-fmtformatdate-pattern-dynamically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!