惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Security Latest
Security Latest
Recorded Future
Recorded Future
人人都是产品经理
人人都是产品经理
S
SegmentFault 最新的问题
Hacker News - Newest:
Hacker News - Newest: "LLM"
C
CXSECURITY Database RSS Feed - CXSecurity.com
博客园 - 三生石上(FineUI控件)
博客园 - 聂微东
P
Privacy & Cybersecurity Law Blog
WordPress大学
WordPress大学
Know Your Adversary
Know Your Adversary
Spread Privacy
Spread Privacy
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
量子位
L
LINUX DO - 热门话题
L
Lohrmann on Cybersecurity
博客园 - Franky
酷 壳 – CoolShell
酷 壳 – CoolShell
T
Tor Project blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
雷峰网
雷峰网
阮一峰的网络日志
阮一峰的网络日志
V
Visual Studio Blog
T
Threatpost
T
Tenable Blog
有赞技术团队
有赞技术团队
大猫的无限游戏
大猫的无限游戏
Engineering at Meta
Engineering at Meta
GbyAI
GbyAI
C
Cisco Blogs
H
Heimdal Security Blog
Attack and Defense Labs
Attack and Defense Labs
A
About on SuperTechFans
Last Week in AI
Last Week in AI
N
News and Events Feed by Topic
T
Threat Research - Cisco Blogs
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
I
Intezer
V
V2EX
Cyberwarzone
Cyberwarzone
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
B
Blog RSS Feed
V
Vulnerabilities – Threatpost
N
Netflix TechBlog - Medium
T
The Blog of Author Tim Ferriss
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
U
Unit 42
PCI Perspectives
PCI Perspectives
P
Privacy International News Feed
D
Docker

博客园 - 疯蜂

Weblogic 页面404错误 WebLogic & MyEclipse 配置 (转)为什么我的网速越来越慢?如何限制迅雷偷偷上传文件? New year ,new scratch line,for the future ×××之品味寂寞 河北省××××××××××网总结 Java开发者需坚守的十大基本准则 Web 软件测试计划 我们的《测试报告》 国内主要的一些测试的网站汇总 测试? 究竟什么才是真正的软件测试? 软件测试常用术语表 测试要点总结(转帖) 软件测试基本方法 I'm Back! 求助:C# WinForm C#导出Excel汇总 2007年暑期总结(李明锋)
Weblogic Server中如何解决中文显示乱码问题 - 疯蜂 - 博客园
疯蜂 · 2008-04-11 · via 博客园 - 疯蜂

由于操作系统、浏览器、数据库、JVM采用的字符集都不一样,基于Weblogic Server开发的应用经常出现中文显示乱码问题,其实在Weblogic Server上运行的WEB应用有很多与字符集有关的设置,下面做一个总结,为了正确处理中文,最好把这些设置都设上。
1. 在JSP文件头加入
<%@ page contentType="text/html; charset=GBK" %>
指定该JSP采用的字符集。

2.在Weblogic.XML文件的<jsp-descriptor>中加入:
<jsp-param>
<param-name>encoding</param-name>
<param-value>GBK</param-value>
</jsp-param>
指定JSP文件中采用的字符集,在JSP文件中的<%@ page contentType="text/html; charset=GBK" %>会覆盖该设置

3.在Weblogic.xml文件的<jsp-descriptor>中加入
<jsp-param>
<param-name>compilerSupportsEncoding</param-name>
<param-value>true</param-value>
</jsp-param>
如果为TRUE,指定在编译JSP文件时,采用在JSP文件中定义的
<%@ page contentType="text/html; charset=GBK" %>或<jsp-descriptor>中定义的encoding参数中定义的字符集进行编码,如果为FALSE,则采用JVM中默认指定的字符集进行编码。

4. Weblogic Server需要把HTTP request(GET 和POST)中的数据从它的原始编码转化为Unicode,以便Java Servlet API进行处理,为了做这种转换,Weblogic Server需要知道HPPT request中的数据的编码方式。这可以通过在Weblogic.xml的<context-param>中设置.
<input-charset>
<resource-path>/</resource-path>
<java-charset-name>GBK</java-charset-name>
</input-charset>

5.从Oracle数据库中检索出来的中文显示不正确时,在这种情况下,如果数据库使用的是中文字符集,并使用的是Type 2 JDBC Driver时,可加入Weblogic.codeset=GBK的属性来解决这个问题。代码如下:
java.util.Properties props = new java.util.Properties();
props.put("Weblogic.codeset", "GBK");
props.put("user", "scott");
props.put("password", "tiger");
String connectUrl = "jdbc:Weblogic:oracle";
Driver myDriver = (Driver)
Class.forName("Weblogic.jdbc.oci.Driver").newInstance();
Connection conn =
myDriver.connect(connectUrl, props);

6. 如果是采用WTC调用Tuxedo中的服务,在JSP页面中无法正确显示中文,必须使安装Tuxedo的服务器上的NLS_LANG环境变量与数据库中的字符集的设置一样。如后台Oracle数据库中的字符集设置为SIMPLIFIED CHINESE_CHINA.ZHS16GBK,那么Tuxedo应用服务器上的NLS_LANG环境变量应设置为:export NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK"