码迷,mamicode.com
首页 > Web开发 > 详细

jsp:jstl标签库国际化 fmt

时间:2018-01-21 17:38:05      阅读:198      评论:0      收藏:0      [点我收藏+]

标签:image   oba   div   目录   coding   efi   sources   jsp   语言   

首先资源文件目录是:src/man/sources (这是它默认的资源文件)

技术分享图片

 

i18n_en_US.properties文件内容

copyright=Copyright \u00A9 2013
language=language
bookname=HTTP by picture

  

jsp内容,因为资源文件还有一层目录,所以bundle的basename需要加上这层目录:i18n.i18n

i18n(目录).i18n开头名

<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body>


<!--指定区域语言-->
<fmt:setLocale value="en_US"/>
<!-- 指定使用basename为globalMessages的资源文件,也即资源文件第一个单词为globalMessages-->
<fmt:bundle basename="i18n.i18n">
<fmt:message key="language"></fmt:message>
<fmt:message key="bookname"></fmt:message>
</fmt:bundle>

</body>
</html>

  

 

jsp:jstl标签库国际化 fmt

标签:image   oba   div   目录   coding   efi   sources   jsp   语言   

原文地址:https://www.cnblogs.com/achengmu/p/8324667.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!