成長(zhǎng)中的記憶
這是我的成長(zhǎng),這是我的天地,學(xué)習(xí)JAVA,只因快樂。
首頁(yè)
新隨筆
新文章
聯(lián)系
聚合
管理
posts - 4,comments - 16,trackbacks - 0
<
2009年12月
>
日
一
二
三
四
五
六
29
30
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
29
30
31
1
2
3
4
5
6
7
8
9
私人天地,請(qǐng)多騷擾。 歡迎來到我的天地,可能沒有您想要的東西,但是還是請(qǐng)您在這里休息一下,快樂一下。
常用鏈接
我的隨筆
我的評(píng)論
我的參與
最新評(píng)論
留言簿
(1)
給我留言
查看公開留言
查看私人留言
隨筆分類
2006年10月(3)
2006年2月(1)
2006年3月
文章分類
Hiberntea(1)
JSP(3)
Junit
Log4J(3)
SQL
Struts(3)
Tomcat(1)
其他(4)
搜索
積分與排名
積分 - 25651
排名 - 1513
最新評(píng)論
1.?re: JSP亂碼解決(過慮器EncodingFilte11111
11111
--1111
2.?re: Struts過濾器的使用,已解決中文問題[未登錄]
這不是struts過濾器
--qin
3.?re: Struts過濾器的使用,已解決中文問題
好,直接房項(xiàng)目里改一下web.xml里的路徑就可以用了
--billmao
4.?re: QQ惡搞頭像
敗跟我玩?zhèn)€性
--姚斌
5.?re: 很好笑的.
不錯(cuò),但也有很辦法去解決這問題!
--恩恩
閱讀排行榜
1.?QQ惡搞頭像(5489)
2.?很好笑的.(616)
3.?你想到了什么?(280)
4.?前世欠你一滴淚 [轉(zhuǎn)](267)
評(píng)論排行榜
1.?很好笑的.(2)
2.?QQ惡搞頭像(1)
3.?你想到了什么?(0)
4.?前世欠你一滴淚 [轉(zhuǎn)](0)
Struts過濾器的使用,已解決中文問題
web.xml
<
filter
>
????????
<
filter
-
name
>
Set?Character?Encoding
</
filter
-
name
>
????????
<
filter
-
class
>
mypack.Charset
</
filter
-
class
>
????????
<
init
-
param
>
????????????
<
param
-
name
>
encoding
</
param
-
name
>
????????????
<
param
-
value
>
UTF
-
8
</
param
-
value
>
????????
</
init
-
param
>
????????
<
init
-
param
>
????????????
<
param
-
name
>
ignore
</
param
-
name
>
????????????
<
param
-
value
>
true
</
param
-
value
>
????????
</
init
-
param
>
????
</
filter
>
??
<
filter
-
mapping
>
????
<
filter
-
name
>
Set?Character?Encoding
</
filter
-
name
>
????
<
servlet
-
name
>
action
</
servlet
-
name
>
??
</
filter
-
mapping
>
過濾的類
package mypack;
import
?java.io.
*
;
import
?javax.servlet.
*
;
public
?
class
?Charset?
implements
?Filter?
{
????
protected
?String?encoding?
=
?
null
;
????
protected
?FilterConfig?filterConfig?
=
?
null
;
????
protected
?
boolean
?ignore?
=
?
true
;
????
public
?
void
?destroy()?
{
????????
this
.encoding?
=
?
null
;
????????
this
.filterConfig?
=
?
null
;
????}
????
public
?
void
?doFilter(ServletRequest?request,?ServletResponse?response,
????????????FilterChain?chain)
throws
?IOException,?ServletException?
{
????????
if
?(ignore?
||
?(request.getCharacterEncoding()?
==
?
null
))?
{
????????????String?encoding?
=
?selectEncoding(request);
????????????
if
?(encoding?
!=
?
null
)
????????????????request.setCharacterEncoding(encoding);
????????}
????????chain.doFilter(request,?response);
????}
????
public
?
void
?init(FilterConfig?filterConfig)?
throws
?ServletException?
{
????????
this
.filterConfig?
=
?filterConfig;
????????
this
.encoding?
=
?filterConfig.getInitParameter(
"
encoding
"
);
????????String?value?
=
?filterConfig.getInitParameter(
"
ignore
"
);
????????
if
?(value?
==
?
null
)
????????????
this
.ignore?
=
?
true
;
????????
else
?
if
?(value.equalsIgnoreCase(
"
true
"
))
????????????
this
.ignore?
=
?
true
;
????????
else
?
if
?(value.equalsIgnoreCase(
"
yes
"
))
????????????
this
.ignore?
=
?
true
;
????????
else
????????????
this
.ignore?
=
?
false
;
????}
????
protected
?String?selectEncoding(ServletRequest?request)?
{
????????
return
?(
this
.encoding);
????}
}
這2個(gè)加進(jìn)工程里,就可以直接運(yùn)行了。不用在設(shè)置什么。
至于數(shù)據(jù)庫(kù)最好設(shè)置為UTF-8.
從此以后遠(yuǎn)離中文出現(xiàn)亂碼的煩惱。哈哈哈
posted on 2006-03-01 11:16
aiyoyoyo
閱讀(4016)
評(píng)論(2)
編輯
收藏
所屬分類:
Struts
FeedBack:
#
re: Struts過濾器的使用,已解決中文問題
2008-12-30 01:01 |
billmao
好,直接房項(xiàng)目里改一下web.xml里的路徑就可以用了
回復(fù)
更多評(píng)論
#
re: Struts過濾器的使用,已解決中文問題[未登錄]
2009-12-11 10:06 |
qin
這不是struts過濾器
回復(fù)
更多評(píng)論
新用戶注冊(cè)
刷新評(píng)論列表
只有注冊(cè)用戶
登錄
后才能發(fā)表評(píng)論。
網(wǎng)站導(dǎo)航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
相關(guān)文章:
Struts過濾器的使用,已解決中文問題
RegExp 正則表達(dá)式
在Struts中使用Validator框架
Copyright ©2025 aiyoyoyo Powered By
博客園
模板提供:
滬江博客
主站蜘蛛池模板:
免费黄色app网站
|
好先生在线观看免费播放
|
一级毛片免费观看不收费
|
亚洲国产黄在线观看
|
97视频免费在线
|
亚洲AV综合色区无码二区偷拍
|
久久久久久国产精品免费免费
|
亚洲精品无码专区2
|
成在人线AV无码免费
|
一区二区三区在线免费看
|
亚洲中文久久精品无码1
|
久久久久久久综合日本亚洲
|
亚洲电影日韩精品
|
亚洲日韩精品无码一区二区三区
|
永久免费av无码网站大全
|
曰曰鲁夜夜免费播放视频
|
国产亚洲综合视频
|
国产亚洲免费的视频看
|
亚洲国产人成中文幕一级二级
|
永久免费视频v片www
|
好先生在线观看免费播放
|
曰批全过程免费视频播放网站
|
无码人妻一区二区三区免费看
|
国产无限免费观看黄网站
|
在线亚洲v日韩v
|
亚洲高清一区二区三区电影
|
亚洲人成77777在线观看网
|
亚洲日韩中文字幕
|
亚洲黄色在线播放
|
日韩伦理片电影在线免费观看
|
久久国产精品免费一区
|
一进一出60分钟免费视频
|
五月天婷婷精品免费视频
|
亚洲看片无码在线视频
|
69成人免费视频无码专区
|
成人免费AA片在线观看
|
欧洲黑大粗无码免费
|
日韩免费观看视频
|
免费日韩在线视频
|
亚洲性日韩精品国产一区二区
|
亚洲XX00视频
|