I'm using the tag in my JSP to display prices, but I noticed something strange. When I set the currency to 'EUR', it correctly shows the euro sign (€). However, when I set it to 'USD', it just displays 'USD' instead of the dollar sign ($). Is this how it's supposed to work? If not, how can I make it show the dollar sign?
4 Answers
Looks like you're running into a common issue. The tag follows the Java NumberFormat rules, and it might show 'USD' instead of '$' if the locale isn’t set to a dollar-using one. To fix this, simply add before your formatNumber tag. This way, it knows to use the dollar sign. So your JSP would look something like this:
```jsp
```
This should output $120,000.23, ensuring you see the dollar sign as expected!
Yep, that's actually how it’s intended to work. If you want to get the dollar sign, you just need to specify the locale appropriately, like so:
```jsp
```
Setting the locale to 'en_US' tells it to format the currency correctly. Otherwise, it assumes you're working within a context where 'USD' should just be written out.
Totally get where you're coming from! Just a note, if you're targeting other dollar-using regions like Australia, you can set the locale to 'en_AU' for A$. Each locale option will show the corresponding currency symbol!
You’re absolutely right, there's a bit of confusion with how currencies are displayed. The default behavior is to display 'USD' when the locale doesn’t indicate a dollar-using country. Setting the locale to 'en_US' will ensure it shows the dollar sign instead. It’s an easy fix!

Related Questions
How to Build a Custom GPT Journalist That Posts Directly to WordPress
Cloudflare Origin SSL Certificate Setup Guide
How To Effectively Monetize A Site With Ads