你的位置:首页 > 软件开发 > Java > 基于Session的国际化实现

基于Session的国际化实现

发布时间:2016-08-28 11:00:08
其他链接:http://blog.csdn.net/jinwufeiyang/article/details/52338268如何将我们网站的其它内容(如菜单、标题等)做国际化处理呢?这就是本篇要将的内容—>国际化。在项目的spring. [html ...

基于Session的国际化实现

其他链接:http://blog.csdn.net/jinwufeiyang/article/details/52338268

如何将我们网站的其它内容(如菜单、标题等)做国际化处理呢?这就是本篇要将的内容—>国际化。

在项目的spring.

 

[html] view plain copy 
  1. package com.zhidao.oms.index;  
  2.   
  3. import java.util.Locale;  
  4.   
  5. import javax.servlet.http.HttpServletRequest;  
  6.   
  7. import org.springframework.stereotype.Controller;  
  8. import org.springframework.web.bind.annotation.RequestMapping;  
  9. import org.springframework.web.bind.annotation.RequestParam;  
  10.   
  11. @Controller  
  12. @RequestMapping("/index")  
  13. public class IndexAction {  
  14.       
  15.       
  16.     @RequestMapping("/findex")  
  17.     public String Findex(HttpServletRequest request,@RequestParam String langType,String page){  
  18.   
  19.     if(langType.equals("zh")){  
  20.             Locale locale = new Locale("zh", "CN");   
  21.             request.getSession().setAttribute("i18nlanguage",locale);   
  22.         }  
  23.         else if(langType.equals("en")){  
  24.             Locale locale = new Locale("en", "US");   
  25.             request.getSession().setAttribute("i18nlanguage",locale);  
  26.         }else{  
  27.             request.getSession().setAttribute("i18nlanguage",Locale.getDefault());  
  28.         }  
  29.         return "/front/"+page+".jsp";  
  30.     }  
  31.       
  32. }  

 

海外公司注册、海外银行开户、跨境平台代入驻、VAT、EPR等知识和在线办理:https://www.xlkjsw.com

原标题:基于Session的国际化实现

关键词:session

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

可能感兴趣文章

我的浏览记录