📄 struts+hibernate(dao)+filter的例子.mht
字号:
ServletResponse response, FilterChain chain<SPAN =
style=3D"COLOR: #000000">)</SPAN> <SPAN=20
style=3D"COLOR: #000000">{</SPAN> <BR> =
=20
<SPAN style=3D"FONT-WEIGHT: bold; COLOR: =
#990066"=20
?>try</SPAN><SPAN style=3D"COLOR: =
#000000">{</SPAN>=20
<BR> =20
request.<SPAN=20
style=3D"COLOR: =
#000000">setCharacterEncoding</SPAN><SPAN=20
style=3D"COLOR: #000000">(</SPAN>this.<SPAN=20
style=3D"COLOR: #000000">encode</SPAN><SPAN=20
style=3D"COLOR: #000000">)</SPAN>; <BR> =
=20
response.<SPAN=20
style=3D"COLOR: =
#000000">setContentType</SPAN><SPAN=20
style=3D"COLOR: =
#000000">(</SPAN>"text/html;charset=3D"+encode<SPAN=20
style=3D"COLOR: #000000">)</SPAN>; <BR> =
=20
chain.<SPAN=20
style=3D"COLOR: #000000">doFilter</SPAN><SPAN=20
style=3D"COLOR: #000000">(</SPAN>request, =
response<SPAN=20
style=3D"COLOR: #000000">)</SPAN>; <BR> =
=20
<SPAN style=3D"COLOR: =
#000000">}</SPAN>=20
<BR> <SPAN=20
style=3D"FONT-WEIGHT: bold; COLOR: #990066"=20
?>catch</SPAN><SPAN style=3D"COLOR: =
#000000">(</SPAN><SPAN=20
style=3D"COLOR: #aaaadd" ?>Exception</SPAN> =
e<SPAN=20
style=3D"COLOR: #000000">)</SPAN><SPAN=20
style=3D"COLOR: #000000">{</SPAN> <BR> =
=20
<SPAN=20
style=3D"FONT-WEIGHT: bold; COLOR: #990066"=20
?>if</SPAN><SPAN style=3D"COLOR: =
#000000">(</SPAN>!<SPAN=20
style=3D"COLOR: #000000">(</SPAN>e instanceof =
java.<SPAN=20
style=3D"COLOR: #000000">net</SPAN>.<SPAN=20
style=3D"COLOR: =
#000000">SocketException</SPAN><SPAN=20
style=3D"COLOR: #000000">)</SPAN><SPAN=20
style=3D"COLOR: #000000">)</SPAN><SPAN=20
style=3D"COLOR: #000000">{</SPAN> <BR> =
=20
<SPAN=20
style=3D"FONT-WEIGHT: bold; COLOR: #990066"=20
?>if</SPAN><SPAN style=3D"COLOR: =
#000000">(</SPAN>request=20
instanceof HttpServletRequest<SPAN=20
style=3D"COLOR: #000000">)</SPAN> <BR> =
=20
=
Logger.<SPAN=20
style=3D"COLOR: #000000">getLogger</SPAN><SPAN=20
style=3D"COLOR: #000000">(</SPAN>this.<SPAN=20
style=3D"COLOR: #000000">getClass</SPAN><SPAN=20
style=3D"COLOR: #000000">(</SPAN><SPAN=20
style=3D"COLOR: #000000">)</SPAN><SPAN=20
style=3D"COLOR: #000000">)</SPAN>.<SPAN=20
style=3D"COLOR: #000000">error</SPAN><SPAN=20
style=3D"COLOR: #000000">(</SPAN>"error request=20
uri:"+<SPAN style=3D"COLOR: =
#000000">(</SPAN><SPAN=20
style=3D"COLOR: =
#000000">(</SPAN>HttpServletRequest<SPAN=20
style=3D"COLOR: #000000">)</SPAN>request<SPAN=20
style=3D"COLOR: #000000">)</SPAN>.<SPAN=20
style=3D"COLOR: =
#000000">getRequestURI</SPAN><SPAN=20
style=3D"COLOR: #000000">(</SPAN><SPAN=20
style=3D"COLOR: #000000">)</SPAN><SPAN=20
style=3D"COLOR: #000000">)</SPAN>; <BR> =
=20
=
Logger.<SPAN=20
style=3D"COLOR: #000000">getLogger</SPAN><SPAN=20
style=3D"COLOR: #000000">(</SPAN>this.<SPAN=20
style=3D"COLOR: #000000">getClass</SPAN><SPAN=20
style=3D"COLOR: #000000">(</SPAN><SPAN=20
style=3D"COLOR: #000000">)</SPAN><SPAN=20
style=3D"COLOR: #000000">)</SPAN>.<SPAN=20
style=3D"COLOR: #000000">error</SPAN><SPAN=20
style=3D"COLOR: #000000">(</SPAN>e<SPAN=20
style=3D"COLOR: #000000">)</SPAN>; <BR> =
=20
<SPAN=20
style=3D"COLOR: #000000">}</SPAN> <BR> =
=20
<SPAN style=3D"COLOR: =
#000000">}</SPAN><SPAN=20
style=3D"FONT-WEIGHT: bold; COLOR: #990066"=20
?>finally</SPAN><SPAN style=3D"COLOR: =
#000000">{</SPAN>=20
<BR> =
=20
<SPAN style=3D"FONT-WEIGHT: bold; COLOR: =
#990066"=20
?>try</SPAN><SPAN style=3D"COLOR: =
#000000">{</SPAN>=20
<BR> =
=20
=20
HibernateSessionFactory.<SPAN=20
style=3D"COLOR: =
#000000">closeSession</SPAN><SPAN=20
style=3D"COLOR: #000000">(</SPAN><SPAN=20
style=3D"COLOR: #000000">)</SPAN>; <BR> =
=20
<SPAN=20
style=3D"COLOR: #000000">}</SPAN><SPAN=20
style=3D"FONT-WEIGHT: bold; COLOR: #990066"=20
?>catch</SPAN><SPAN style=3D"COLOR: =
#000000">(</SPAN><SPAN=20
style=3D"COLOR: #aaaadd" ?>Exception</SPAN> =
ex<SPAN=20
style=3D"COLOR: #000000">)</SPAN><SPAN=20
style=3D"COLOR: #000000">{</SPAN> <BR> =
=20
=
=20
<SPAN style=3D"COLOR: #aaaadd"=20
?>System</SPAN>.<SPAN=20
style=3D"COLOR: #000000">out</SPAN>.<SPAN=20
style=3D"COLOR: #000000">println</SPAN><SPAN=20
style=3D"COLOR: #000000">(</SPAN>"<SPAN=20
style=3D"COLOR: #aaaadd" ?>Error</SPAN> in =
closing=20
session"<SPAN style=3D"COLOR: #000000">)</SPAN>; =
<BR> =
=20
<SPAN style=3D"COLOR: =
#000000">}</SPAN> =20
<BR> =
=20
<SPAN style=3D"COLOR: #000000">}</SPAN> =
<BR> =20
<SPAN style=3D"COLOR: #000000">}</SPAN> =
<BR><BR> =20
<SPAN style=3D"FONT-WEIGHT: bold; COLOR: =
#990066"=20
?>public</SPAN> <SPAN=20
style=3D"FONT-WEIGHT: bold; COLOR: #990066" =
?>void</SPAN>=20
destroy<SPAN style=3D"COLOR: =
#000000">(</SPAN><SPAN=20
style=3D"COLOR: #000000">)</SPAN> <SPAN=20
style=3D"COLOR: #000000">{</SPAN> <BR> =
<SPAN=20
style=3D"COLOR: #000000">}</SPAN> <BR><SPAN=20
style=3D"COLOR: =
#000000">}</SPAN></DIV><BR></TD></TR></TBODY></TABLE><SPAN=20
=
class=3Dpostbody><BR>=D2=D4=C9=CF=CA=C7hibernate=CF=E0=B9=D8=B2=BF=B7=D6.=
</SPAN>=20
<STYLE type=3Dtext/css>TD.attachrow {
BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-COLOR: #000000; FONT: 11px =
Verdana, Arial, Helvetica, sans-serif; COLOR: #000000; BORDER-TOP-COLOR: =
#000000; BORDER-RIGHT-COLOR: #000000
}
TD.attachheader {
BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-COLOR: #000000; FONT: 11px =
Verdana, Arial, Helvetica, sans-serif; COLOR: #000000; BORDER-TOP-COLOR: =
#000000; BACKGROUND-COLOR: #d1d7dc; BORDER-RIGHT-COLOR: #000000
}
TABLE.attachtable {
BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-COLOR: #000000; FONT: 12px =
Verdana, Arial, Helvetica, sans-serif; COLOR: #000000; BORDER-TOP-COLOR: =
#000000; BORDER-COLLAPSE: collapse; BORDER-RIGHT-COLOR: #000000
}
</STYLE>
<SPAN class=3Dpostbody></SPAN><SPAN=20
=
class=3Dgensmall><BR><BR>=C9=CF=D2=BB=B4=CE=D3=C9lizwjiang=D3=DA2004-3-18=
=D6=DC=CB=C4,=20
=
=C9=CF=CE=E711:48=D0=DE=B8=C4=A3=AC=D7=DC=B9=B2=D0=DE=B8=C4=C1=CB1=B4=CE<=
/SPAN></TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD class=3Drow1 vAlign=3Dcenter align=3Dleft =
width=3D150><SPAN class=3Dnav><A=20
class=3Dnav=20
=
href=3D"http://forum.javaeye.com/viewtopic.php?t=3D3687&postdays=3D0&=
amp;postorder=3Dasc&start=3D0#top">=B7=B5=BB=D8=B6=A5=B6=CB</A></SPAN=
></TD>
<TD class=3Drow1 vAlign=3Dbottom noWrap width=3D"100%" =
height=3D28>
<TABLE height=3D18 cellSpacing=3D0 cellPadding=3D0 =
width=3D18 border=3D0>
<TBODY>
<TR>
<TD vAlign=3Dcenter noWrap><A=20
=
href=3D"http://forum.javaeye.com/profile.php?mode=3Dviewprofile&u=3D6=
93"><IMG=20
title=3D=D4=C4=B6=C1=BB=E1=D4=B1=D7=CA=C1=CF =
alt=3D=D4=C4=B6=C1=BB=E1=D4=B1=D7=CA=C1=CF=20
=
src=3D"http://forum.javaeye.com/templates/subSilver/images/lang_chinese_s=
implified/icon_profile.gif"=20
border=3D0></A> <A=20
=
href=3D"http://forum.javaeye.com/privmsg.php?mode=3Dpost&u=3D693"><IM=
G=20
title=3D=B7=A2=CB=CD=D5=BE=C4=DA=B6=CC=D0=C5 =
alt=3D=B7=A2=CB=CD=D5=BE=C4=DA=B6=CC=D0=C5=20
=
src=3D"http://forum.javaeye.com/templates/subSilver/images/lang_chinese_s=
implified/icon_pm.gif"=20
border=3D0></A> </TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD class=3DspaceRow colSpan=3D2 height=3D1><IMG height=3D1 =
alt=3D""=20
=
src=3D"http://forum.javaeye.com/templates/subSilver/images/spacer.gif"=20
width=3D1></TD></TR>
<TR>
<TD class=3Drow2 vAlign=3Dtop align=3Dleft width=3D150><SPAN =
class=3Dname><A=20
name=3D17913></A><B>lizwjiang</B></SPAN><BR><SPAN=20
class=3Dpostdetails><STRONG></STRONG>Macromedia JRun<BR><IMG =
title=3D"Macromedia JRun" alt=3D"Macromedia JRun"=20
src=3D"http://forum.javaeye.com/images/rank/rank4.gif"=20
border=3D0><BR><IMG alt=3D""=20
=
src=3D"http://forum.javaeye.com/images/avatars/189160942740ad495e690b6.jp=
g"=20
border=3D0><BR><BR>=D0=D4=B1=F0:<IMG =
title=3D=D0=D4=B1=F0:=C4=D0 alt=3D=D0=D4=B1=F0:=C4=D0=20
=
src=3D"http://forum.javaeye.com/templates/subSilver/images/icon_minigende=
r_male.gif"=20
border=3D0><BR><BR><BR>=BC=D3=C8=EB=CA=B1=BC=E4: =
2003/10/07<BR>=CE=C4=D5=C2: 58<BR><BR><IMG title=3D=C0=EB=CF=DF=20
alt=3D=C0=EB=CF=DF=20
=
src=3D"http://forum.javaeye.com/templates/subSilver/images/offline.gif"=20
border=3D0></SPAN><BR></TD>
<TD class=3Drow2 vAlign=3Dtop width=3D"100%" height=3D28>
<TABLE cellSpacing=3D0 cellPadding=3D0 width=3D"100%" =
border=3D0>
<TBODY>
<TR>
<TD width=3D"100%"><A=20
=
href=3D"http://forum.javaeye.com/viewtopic.php?p=3D17913#17913"><IMG=20
title=3D=CE=C4=D5=C2 height=3D9 alt=3D=CE=C4=D5=C2=20
=
src=3D"http://forum.javaeye.com/templates/subSilver/images/icon_minipost.=
gif"=20
width=3D12 border=3D0></A><SPAN =
class=3Dpostdetails>=CA=B1=BC=E4: 2004-3-17=20
08:54:09<SPAN class=3Dgen> </SPAN> =
=B1=EA=CC=E2:=20
=BD=D3=C9=CF=B2=BF=B7=D6</SPAN></TD>
<TD vAlign=3Dtop noWrap><A=20
=
href=3D"http://forum.javaeye.com/posting.php?mode=3Dquote&p=3D17913">=
<IMG=20
title=3D=D2=FD=D3=C3=BB=D8=B8=B4 =
alt=3D=D2=FD=D3=C3=BB=D8=B8=B4=20
=
src=3D"http://forum.javaeye
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -