<mvc:interceptors> <span style="white-space:pre"> </span><!-- 国际化操作拦截器 如果采用基于(请求/Session/Cookie)则必需配置 --> <bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor" /> </mvc:interceptors>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<%
Locale name = (Locale) session.getAttribute("i18nlanguage");
ResourceBundle myResourcesBundle = ResourceBundle.getBundle("myproperties",name);
%>
<body>
<a href="${pageContext.request.contextPath}/index/findex.do?langType=en&page=Home">ENG</a> |
<a href="${pageContext.request.contextPath}/index/findex.do?langType=zh&page=Home"><%=myResourcesBundle.getString("simplified")%></a>
</body>
</html>
package com.zhidao.oms.index;
import java.util.Locale;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
@Controller
@RequestMapping("/index")
public class IndexAction {
@RequestMapping("/findex")
public String Findex(HttpServletRequest request,@RequestParam String langType,String page){
if(langType.equals("zh")){
Locale locale = new Locale("zh", "CN");
request.getSession().setAttribute("i18nlanguage",locale);
}
else if(langType.equals("en")){
Locale locale = new Locale("en", "US");
request.getSession().setAttribute("i18nlanguage",locale);
}else{
request.getSession().setAttribute("i18nlanguage",Locale.getDefault());
}
return "/front/"+page+".jsp";
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2026 源码网商城 (www.ymwmall.com) 版权所有