首页 > 代码库 > Java web----国际化

Java web----国际化

技术分享

技术分享

package com.cug.local;

import java.util.Locale;
import java.util.ResourceBundle;

import org.junit.Test;

public class Demo01 {
	@Test
	public void fun1(){
		Locale locale = Locale.US;
		ResourceBundle rb = ResourceBundle.getBundle("res", locale);
		System.out.println(rb.getString("username"));
		System.out.println(rb.getString("password"));
		System.out.println(rb.getString("login"));
	}
}

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href=http://www.mamicode.com/"">>



Java web----国际化