Java蜘蛛人 歡迎大家

          歡迎大家 來到我的blog , 如果我身邊的朋友 有什么不懂可以直接來問我 我會細(xì)心的幫助你的. 如果網(wǎng)絡(luò)上的朋友有什么不懂的 可以加我Java蜘蛛人 QQ48187537
          posts - 54, comments - 192, trackbacks - 0, articles - 1

          Spring 中的國際化

          Posted on 2008-03-05 18:09 Java蜘蛛人 --鄭成橋 閱讀(1341) 評論(1)  編輯  收藏
          <?xml version="1.0" encoding="UTF-8"?>
          <beans
              xmlns
          ="http://www.springframework.org/schema/beans"
              xmlns:xsi
          ="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation
          ="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">



          <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
          <property name="basename" value="messages"></property>

           
          </bean>

          </beans>
          import java.util.Date;
          import java.util.Locale;

          import org.springframework.context.ApplicationContext;
          import org.springframework.context.MessageSource;
          import org.springframework.context.support.ClassPathXmlApplicationContext;

          public class TestBean {
              
              
          public static void main(String[] args) {
                  
                  ApplicationContext context
          =null;
                  
                  context
          =new ClassPathXmlApplicationContext("guojihua.xml");
                  Object[] a
          =new Object[]{"鄭成橋",new Date()};
              System.out.println(context.getMessage(
          "user", a,Locale.SIMPLIFIED_CHINESE));
                  
              }

          }


          上面Object[] 里面的user 是國際化里的配置的
          user=\u6B22\u8FCE{0},\u7684\u5230\u6765\u73B0\u5728\u662F{1}

          如果看不懂 ,  就直接加我的 QQ 問吧...

          Feedback

          # re: Spring 中的國際化  回復(fù)  更多評論   

          2014-04-27 19:26 by 最代碼
          請參考代碼: 基于瀏覽器首選語言的springmvc和freemarker國際化配置的實(shí)現(xiàn),下載地址:http://www.zuidaima.com/share/1634244049275904.htm

          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 珲春市| 凌海市| 天长市| 名山县| 淮北市| 高唐县| 年辖:市辖区| 普宁市| 麟游县| 微博| 根河市| 肥东县| 泰宁县| 浦江县| 定兴县| 哈密市| 兰坪| 迭部县| 荣成市| 阿城市| 定兴县| 大理市| 海阳市| 阿巴嘎旗| 桑日县| 夏邑县| 洛川县| 苍南县| 名山县| 门头沟区| 恩施市| 玛纳斯县| 双鸭山市| 临高县| 田阳县| 九龙坡区| 泽普县| 墨江| 报价| 锡林郭勒盟| 滁州市|