简体   繁体   中英

How to get currency symbol in JSP for specifc locale

I'm wordering how to display just the currency symbol for a specifc locale and currency code (3 letters code: for example GBP) in jsp/html.

For example, with currency code GBP and locale en-GB it will displays £ (but the locale can change).

Thanks

Yes the answer from Avinash will also render the value. If you just want to render the symbol, there are two possibilities: 1.) HTML £ (more on currency symbols ) 2.) Store the symbol in the message.property file and add it with to the jsp.

You could use the currencySymbol attribute and set the value.

THE code would be like

<fmt:formatNumber value="${amount}" type="currency" currencySymbol="FOO" currencyCode="${currencyCode}" var="amt" />

as mentioned here .

Have a look here too

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM