`
radzhang
  • 浏览: 303053 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

Struts.locale多语言问题

 
阅读更多

session过期之后,页面跳转到sessiontimeout的画面里去了。因为session的值已经无法获取,所以显示的语言i18n用的是strtus.xml里默认设置的<constant name="struts.locale" value="zh_CN" />。但是如果在英文环境下,sessiontimeout的错误信息还是显示的中文,立马想到改成<constant name="struts.locale" value="en_US" />。的确,sessiontimeout的错误信息显示的是英文了,但是产生了另外的一个问题。

就是js加载的中文变成了乱码,

比较了一下struts.locale的两个参数值。

当zh_CN的时候,

http标头:

Content-Language: zh-hans-CN  

Content-Type: application/javascript;

en_US的时候,js加载竟然会自动加上charset=ISO-8859-1

Content-Language: en-US  

Content-Type: application/javascript; charset=ISO-8859-1

 

然后我把所有JavaScript引用的地方都加上了charset=‘UTF-8’也还是没有作用。

<script src="/js/message.js" type="text/javascript" charset="UTF-8"></script>

不知道为什么原因。暂时保留。

 

 

 

分享到:
评论

相关推荐

    Struts课堂笔记.rar--struts2的struts.properties配置文件详解

    The org.apache.struts2.config.Configuration implementation class org.apache.struts2.config.Configuration接口名 struts.configuration.files A list of configuration files automatically loaded by ...

    C语言头文件 LOCALE.H

    C语言头文件 LOCALE.HC语言头文件 LOCALE.HC语言头文件 LOCALE.HC语言头文件 LOCALE.HC语言头文件 LOCALE.HC语言头文件 LOCALE.HC语言头文件 LOCALE.HC语言头文件 LOCALE.HC语言头文件 LOCALE.HC语言头文件 LOCALE....

    Apps.Locale.resources.dll

    Apps.Locale.resources.dll

    jqgrid demo 中文语言文件(grid.locale-zh_CN.js)

    jqgrid demo 中文语言文件(grid.locale-zh_CN.js)

    grid.locale-cn.js

    grid.locale-cn.js,jqgrid控件专用js文件,缺失备用,即下即用。

    grid.locale-cn.rar

    grid.locale-cn.js是jqgrid插件中文提示的js文件,下载后可以直接使用,非常的方便!

    Apps.Locale.dll

    Apps.Locale.dll

    jqGrid 3.4.4中文提示文件grid.locale-cn.js

    本中文提示文件是根据原版英文grid.locale-en.js翻译而成,其中grid.locale-cn-min.js使用YUI...使用时,替换include: true, incfile:'grid.locale-en.js',minfile: 'min/grid.locale-en-min.js'}或新增一行include.

    Struts2属性文件详解

    指定Web应用的默认Locale. struts.i18n.encoding 指定Web应用的默认编码集.该属性对于处理中文请求参数非常有用,对于获取中文请求参数值,应该将该属性值设置为GBK或者GB2312; 提示: 当设置该参数为GBK时,相当于调用...

    Spring MVC Locale 的使用 中文 英文 等语言 切换

    NULL 博文链接:https://frank1998819.iteye.com/blog/1050339

    中文提示文件grid.locale-cn.js

    解决jqGrid中文乱码,根据原版英文grid.locale-en.js翻译而成

    解决struts2.1.6+spring+hibernate 中文乱码

    struts.properties设置( struts.objectFactory = spring struts.i18n.reload=true ... org.apache.struts2.dispatcher.ActionContextCleanUp &lt;filter-name&gt;struts-cleanup &lt;url-pattern&gt;/* &lt;/filter-mapping&gt;

    Locale

    java.util.Locale

    java中文乱码解决方案

    n 种方法教你解决java中文乱码 struts2中文乱码解决方法 1. 在struts2里面,最好将所有字符都设成utf-8。 ; charset=UTF-8"%&gt; &lt;%@ page pageEncoding="UTF-8" %&gt;1.1 在jsp页面设定字符编码。...-- zh-...

    解决React在安装antd之后出现的Can’t resolve ‘./locale’问题

    React在安装antd之后出现的Can’t resolve ‘./locale’问题,是因为moment在2.2之后的版本都有问题,而react默认使用了最新的moment,但是在moment@2.18.1中是没有问题的。 解决方案就是配置webpack的alias,将所有...

    grid.locale-cn.js 自家博客专用

    很多时候在网上下载一段代码,结果引用的CSS和JS文件不知道从哪里弄,结果上网下载,不是版本不对,就是完全不对。这里的JS是有对应的代码段的。请参考博客 ====&gt; Jqgrid学习笔记__01__初来乍到

    grid.locale-zh.js

    整理了一个jqgrid的汉化版本供大家下载使用!

    Struts in Action中文版

    2.6.2. Struts的强项........................................................................................................58 Struts in Action 中文版 Lastest Revised:10/14/2005 10:27:00 AM ...

    struts in Action

    1.1.1. 谁创建了Struts?...................................................................................................19 1.1.2. 为什么Struts 要开源?....................................................

    Locale.Emulator.2.4.0.0

    Locale Emulator is a tool similar to MS AppLocale and NTLEA, providing a simulation function that can make an application recognize your OS as in a language other than the real one. It is quite useful...

Global site tag (gtag.js) - Google Analytics