code022.jsp
<%@page import="java.util.Locale"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>国际化</title>
</head>
<body>
<%
Locale localex1 = request.getLocale();
String str = "";
if(localex1.toString().contains((Locale.US.toString())))
{
str = "hello,welcome to access our company!";
}
if(localex1.toString().contains(Locale.CHINA.toString()))
{
str = "你好,欢迎访问我们公司的网站!";
}
%>
locaex1 = <%= localex1 %><br>
Local.CHINA = <%= Locale.CHINA %><br>
<%= str %><br>
</body>
</html>