问题
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