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      当前查看项目的浏览器,更改浏览器显示的语言

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

     

  • 相关阅读:
    数据库维护单数据修改(入库单月份更改)
    Git下载GitHub上的文件
    水晶报表的步骤
    html表格及列表
    html中的a标签
    了解html标签
    常见编码方式(码表)
    了解html
    Odoo官方翻译网站
    postgresql性能的几个重要参数
  • 原文地址:https://www.cnblogs.com/pan1308/p/3337519.html
Copyright © 2011-2022 走看看