springmvc 12 国际化

  1. 配置springmvc.xml

    
        
    
    
    
    
    
    
    
    
        
            
        
    
  1. src下创建资源文件
    message_en_US.properties
language.cn = Chinese
language.en = English
language.username = username
language.password = password
language.submit = submit

message_zh_CN.properties

language.cn = \u4e2d\u6587
language.en = \u82f1\u6587
language.username = \u7528\u6237\u540D
language.password = \u5BC6\u7801
language.submit = \u63D0\u4EA4

目标方法

    @RequestMapping("/testI18n")
    public String testI18n(){
        return "i18n";
    }

前端页面

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    
<%@taglib prefix="spring" uri="http://www.springframework.org/tags" %>




Insert title here


    Language:  - 
    
:
:
springmvc 12 国际化_第1张图片
Paste_Image.png
springmvc 12 国际化_第2张图片
internationalization.gif

你可能感兴趣的:(springmvc 12 国际化)