標籤:bean mat type etl val name 美國 png http
1 <body>2 <fmt:setLocale value="en_us"/> //強行將瀏覽器中的語言編碼設定為ja3 <fmt:bundle basename="guo" >4 <fmt:message key="gretting"></fmt:message>5 </fmt:bundle>
6 <c:set var="price" value="1000"></c:set>
<fmt:formatNumber type="currency" value="${price }"></fmt:formatNumber>
7 </body>
結果:
//basename="guo" 不能加副檔名,表示guo.properties為基準配置,<fmt:message key="gretting"> 表示輸出key為gretting的值,如果此時瀏覽器的語言優先順序
是中文的話,那麼顯示中文配置guo_zh.properties中的gretting的值,如果此時瀏覽器的語言優先順序是日文的話,那麼顯示日文配置guo_ja.properties中的gretting的值.
如果瀏覽器中是其他語言優先的話,則預設顯示基準配置(guo.properties)中的key值。
//<fmt:formatNumber type="currency" value="${price }"></fmt:formatNumber> 用於顯示當前瀏覽器的語言地區的貨幣符號。如,<fmt:setLocale value="en_us"/>將語言編碼強轉為美國英文,所以貨幣為美元符。
1 <body>2 <fmt:setLocale value="zh_CN"/>3 <fmt:bundle basename="guo" >4 <fmt:message key="gretting"></fmt:message>5 </fmt:bundle> 6 7 <jsp:useBean id="now" class="java.util.Date"></jsp:useBean>8 <fmt:formatDate value="${now}" />9 </body>
結果:
//<fmt:formatDate value="${now}" /> 將now對象用當前瀏覽器的語言地區的風格顯示。
JSP 之國際化