Hello, I'm trying to localize currency on my JSP web application, problem is when I ask for locale, I only get language code ("en") instead of full language and country code ("en_US"). Problem with this is, formatNumber doesnt work when setLocale's value doesn't contain language and country code.
I can solve it by checking for locale language at the beginning of the jsp page and setting default country code for few languages and then setting value of setLocale, but this method looks pretty ugly to me. Is there a better way of doing this?
This is how I do it now:
<c:choose>
<c:when test="${pageContext.response.locale == 'cs'}">
<f:setLocale value="cs_CZ" />
</c:when>
<c:otherwise>
<f:setLocale value="en_US" />
</c:otherwise>
</c:choose>
<f:formatNumber type="currency" value="${product.price}" currencyCode="CZK"/>