zoukankan      html  css  js  c++  java
  • struts2-note1(struts2国际化)

    在jsp中进行简单的国际化操作。

    1、在struts.xml文件中的<struts></struts>标签内添加

        <!-- 配置国际化资源包 -->
        <constant name="struts.custom.i18n.resources" value="message"></constant>

    2、src目录下新建message_en_US.properties,内容为

    hello=add user

    新建message1.properties文件,内容为hello=你好;

    通过cmd命令,输入   native2ascii  message1.properties  message_zh_CN.properties,后将生成

    message_zh_CN.properties文件,其内容为hello=u589eu52a0u7528u6237;

    3、新建一个jsp文件对内容进行显示:

    jsp文件中加入:<%@ taglib prefix="s" uri="/struts-tags"%>

    显示内容:<s:text name="hello"/>

    4、部署项目、启动服务器便可以查看的到效果。

    5、查看不同的国际化语言效果,需要更改2个地方:

         5.1   “控制面板”-- “区域和语言”-- "位置" -- “当前位置” (更改为当前的国家)

         5.2      当前查看项目的浏览器,更改浏览器显示的语言

    这样,可以查看的到不同的语言效果。

     

  • 相关阅读:
    AE旋转
    AE2
    AE1
    面试
    TS 基础数据类型
    vue-cli结构介绍
    js异步加载的5种方式
    slot 插槽的使用
    使用组件的细节点
    Vue 条件渲染
  • 原文地址:https://www.cnblogs.com/pan1308/p/3337519.html
Copyright © 2011-2022 走看看