Format date in JSP for unsupported Locale [duplicate]
I have a date and I want to output it in a JSP. Currently I use JSTL:
<fmt:formatDate pattern="dd MMMM yyyy" value="${date}"开发者_开发问答 />
Which is very neat as long as the user's language is one that is supported by the JRE. However, we have a requirement to provide this user interface in Welsh. If there a nice way to get the name of the month output in Welsh?
If using Java 6, APIs have been exposed to allow you to add localization support to locales that are not supported by the JRE itself. See the "Local sensitive services" section in the following link for a brief overview: http://java.sun.com/developer/technicalArticles/javase/i18n_enhance/
An alternative option is to build your own custom tag which uses custom resource bundles to display the month in the correct language.
精彩评论