成長中的記憶
這是我的成長,這是我的天地,學習JAVA,只因快樂。
首頁
新隨筆
新文章
聯系
聚合
管理
posts - 4,comments - 16,trackbacks - 0
<
2025年5月
>
日
一
二
三
四
五
六
27
28
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
私人天地,請多騷擾。 歡迎來到我的天地,可能沒有您想要的東西,但是還是請您在這里休息一下,快樂一下。
常用鏈接
我的隨筆
我的評論
我的參與
最新評論
留言簿
(1)
給我留言
查看公開留言
查看私人留言
隨筆分類
2006年10月(3)
2006年2月(1)
2006年3月
文章分類
Hiberntea(1)
JSP(3)
Junit
Log4J(3)
SQL
Struts(3)
Tomcat(1)
其他(4)
搜索
積分與排名
積分 - 25651
排名 - 1515
最新評論
1.?re: JSP亂碼解決(過慮器EncodingFilte11111
11111
--1111
2.?re: Struts過濾器的使用,已解決中文問題[未登錄]
這不是struts過濾器
--qin
3.?re: Struts過濾器的使用,已解決中文問題
好,直接房項目里改一下web.xml里的路徑就可以用了
--billmao
4.?re: QQ惡搞頭像
敗跟我玩個性
--姚斌
5.?re: 很好笑的.
不錯,但也有很辦法去解決這問題!
--恩恩
閱讀排行榜
1.?QQ惡搞頭像(5489)
2.?很好笑的.(616)
3.?你想到了什么?(280)
4.?前世欠你一滴淚 [轉](267)
評論排行榜
1.?很好笑的.(2)
2.?QQ惡搞頭像(1)
3.?你想到了什么?(0)
4.?前世欠你一滴淚 [轉](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個加進工程里,就可以直接運行了。不用在設置什么。
至于數據庫最好設置為UTF-8.
從此以后遠離中文出現亂碼的煩惱。哈哈哈
posted on 2006-03-01 11:16
aiyoyoyo
閱讀(4016)
評論(2)
編輯
收藏
所屬分類:
Struts
FeedBack:
#
re: Struts過濾器的使用,已解決中文問題
2008-12-30 01:01 |
billmao
好,直接房項目里改一下web.xml里的路徑就可以用了
回復
更多評論
#
re: Struts過濾器的使用,已解決中文問題[未登錄]
2009-12-11 10:06 |
qin
這不是struts過濾器
回復
更多評論
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發表評論。
網站導航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
相關文章:
Struts過濾器的使用,已解決中文問題
RegExp 正則表達式
在Struts中使用Validator框架
Copyright ©2025 aiyoyoyo Powered By
博客園
模板提供:
滬江博客
主站蜘蛛池模板:
日本人护士免费xxxx视频
|
一个人看www在线高清免费看
|
大桥未久亚洲无av码在线
|
国产偷国产偷亚洲清高APP
|
美女视频黄的全免费视频
|
免费人妻av无码专区
|
亚洲AV无码专区亚洲AV伊甸园
|
亚洲男女性高爱潮网站
|
羞羞漫画登录页面免费
|
亚洲另类精品xxxx人妖
|
亚洲AV综合永久无码精品天堂
|
久久国产精品免费一区
|
97精品免费视频
|
国产大片91精品免费观看男同
|
亚洲日韩中文字幕天堂不卡
|
国产精品免费观看视频
|
成年轻人网站色免费看
|
亚洲国产精品无码专区影院
|
亚洲精华液一二三产区
|
免费A级毛片在线播放不收费
|
日韩在线观看免费完整版视频
|
久久久www成人免费毛片
|
亚洲视频在线观看不卡
|
美景之屋4在线未删减免费
|
亚洲免费日韩无码系列
|
国产精品亚洲综合久久
|
亚洲国产成人va在线观看网址
|
无码视频免费一区二三区
|
美女视频黄频a免费
|
久久久久久久尹人综合网亚洲
|
妞干网在线免费观看
|
中文字幕亚洲精品资源网
|
成人午夜大片免费7777
|
日本精品久久久久久久久免费
|
久久久无码精品亚洲日韩蜜臀浪潮
|
国产AV日韩A∨亚洲AV电影
|
免费一级国产生活片
|
久操视频在线免费观看
|
国产成人麻豆亚洲综合无码精品
|
美女免费精品高清毛片在线视
|
国产成人无码综合亚洲日韩
|