LoveBegin
Time Stamp
BlogJava
首頁
新隨筆
聯(lián)系
聚合
管理
隨筆-5 評論-0 文章-0 trackbacks-0
struts1 JSP頁面表單向MYSQL數(shù)據(jù)庫提交漢字的字符串 出現(xiàn)亂碼的情況解決辦法
配置過濾器 設置字符集為GBK (注:mysql數(shù)據(jù)庫和JSP頁面都是使用GBK字符集)
CharFilterToGBK javax.servlet.Filter;
public
class
CharFilterToGBK
implements
Filter
{
public
void
destroy()
{
//
TODO Auto-generated method stub
}
public
void
doFilter(ServletRequest request, ServletResponse response,
FilterChain filterChain)
throws
IOException, ServletException
{
request.setCharacterEncoding(
"
GBK
"
);
response.setCharacterEncoding(
"
GBK
"
);
filterChain.doFilter(request, response);
}
配置web.xml文件 注冊該過濾器
<
filter
>
<
filter-name
>
charFilterToGBK
</
filter-name
>
<
filter-class
>
study.filter.CharFilterToGBK
</
filter-class
>
</
filter
>
<
filter-mapping
>
<
filter-name
>
charFilterToGBK
</
filter-name
>
<
url-pattern
>
/*
</
url-pattern
>
</
filter-mapping
>
posted on 2010-02-10 09:45
心情
閱讀(520)
評論(0)
編輯
收藏
所屬分類:
struts
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發(fā)表評論。
網(wǎng)站導航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
相關文章:
org.apache.struts.validator.DynaValidatorForm
struts1 JSP頁面表單向MYSQL數(shù)據(jù)庫提交漢字的字符串 出現(xiàn)亂碼的情況解決辦法
struts1 中ActionForm表單中日期格式的初期 java.sql.Date
<
2010年2月
>
日
一
二
三
四
五
六
31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
1
2
3
4
5
6
7
8
9
10
11
12
13
常用鏈接
我的隨筆
我的評論
我的參與
留言簿
給我留言
查看公開留言
查看私人留言
隨筆分類
mysql(2)
struts(3)
隨筆檔案
2010年2月 (5)
搜索
最新評論
閱讀排行榜
1.?struts1 中ActionForm表單中日期格式的初期 java.sql.Date(640)
2.?struts1 JSP頁面表單向MYSQL數(shù)據(jù)庫提交漢字的字符串 出現(xiàn)亂碼的情況解決辦法(520)
3.?org.apache.struts.validator.DynaValidatorForm(453)
4.?mysql 中文亂碼 中文讀寫錯誤問題 的解決辦法(387)
5.?mysql數(shù)據(jù)庫DateTime與TimeStamp比較(236)
評論排行榜
1.?org.apache.struts.validator.DynaValidatorForm(0)
2.?struts1 JSP頁面表單向MYSQL數(shù)據(jù)庫提交漢字的字符串 出現(xiàn)亂碼的情況解決辦法(0)
3.?struts1 中ActionForm表單中日期格式的初期 java.sql.Date(0)
4.?mysql數(shù)據(jù)庫DateTime與TimeStamp比較(0)
5.?mysql 中文亂碼 中文讀寫錯誤問題 的解決辦法(0)
Powered by:
博客園
模板提供:
滬江博客
Copyright ©2025 心情
主站蜘蛛池模板:
林西县
|
长沙市
|
大名县
|
黄石市
|
德化县
|
石家庄市
|
麻城市
|
酉阳
|
沧州市
|
小金县
|
镇坪县
|
峨边
|
同心县
|
斗六市
|
祥云县
|
平凉市
|
金堂县
|
江门市
|
武宁县
|
福安市
|
股票
|
肃南
|
安西县
|
尉氏县
|
舟山市
|
班玛县
|
大悟县
|
佛学
|
南澳县
|
泽库县
|
霍邱县
|
长沙市
|
平罗县
|
杭锦后旗
|
巴中市
|
大关县
|
绥德县
|
盐池县
|
台南市
|
谢通门县
|
扎兰屯市
|