动态更改fmt:formatDate模式 [英] Change fmt:formatDate pattern dynamically

查看:127
本文介绍了动态更改fmt:formatDate模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要根据本地化动态更改fmt:formatDate模式. 我有每个带有date.format键的语言环境的属性文件,它的值在某个地方是MM/dd/YYYY,在某个地方是DD/MM/YYYY,依此类推. 在JSP中,我具有以下标记:

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" />

我得到的异常是java.lang.IllegalArgumentException: Illegal pattern character 'p' 这段代码有什么问题?

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

推荐答案

该模式似乎没有按预期出现.检查以查看date.format的春季消息是什么.

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

这篇关于动态更改fmt:formatDate模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆