📄 struts 2_0的action讲解 - max on java - blogjava.mht
字号:
style=3D"COLOR: #0000ff">></SPAN> <SPAN style=3D"COLOR: =
#000000"><BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff"><</SPAN> <SPAN style=3D"COLOR: =
#800000">body</SPAN>=20
<SPAN style=3D"COLOR: #0000ff">></SPAN> <SPAN style=3D"COLOR: =
#000000"><BR> =20
</SPAN><SPAN style=3D"COLOR: #0000ff"><</SPAN> <SPAN=20
style=3D"COLOR: #800000">h2</SPAN> <SPAN style=3D"COLOR: =
#0000ff">><</SPAN>=20
<SPAN style=3D"COLOR: #800000">s:property </SPAN><SPAN=20
style=3D"COLOR: #ff0000">value</SPAN> <SPAN=20
style=3D"COLOR: #0000ff">=3D"message"</SPAN> <SPAN=20
style=3D"COLOR: #0000ff">/></</SPAN> <SPAN style=3D"COLOR: =
#800000">h2</SPAN>=20
<SPAN style=3D"COLOR: #0000ff">></SPAN> <SPAN=20
style=3D"COLOR: #000000"><BR></SPAN><SPAN style=3D"COLOR: =
#0000ff"></</SPAN>=20
<SPAN style=3D"COLOR: #800000">body</SPAN> <SPAN=20
style=3D"COLOR: #0000ff">></SPAN> <SPAN style=3D"COLOR: =
#000000"><BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff"></</SPAN> <SPAN style=3D"COLOR: =
#800000">html</SPAN>=20
<SPAN style=3D"COLOR: #0000ff">></SPAN> </DIV><SPAN=20
style=3D"FONT-SIZE: smaller; FONT-STYLE: italic">=E4=BE=8B1 =
HelloWorld.jsp</SPAN> <BR><BR>
<DIV=20
style=3D"BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; =
BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; =
PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; =
WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px =
solid; BACKGROUND-COLOR: #eeeeee"><IMG=20
src=3D"http://www.blogjava.net/Images/OutliningIndicators/None.gif" =
align=3Dtop>=20
<SPAN style=3D"COLOR: #0000ff">package</SPAN> <SPAN=20
style=3D"COLOR: #000000">tutorial;<BR><IMG=20
src=3D"http://www.blogjava.net/Images/OutliningIndicators/None.gif"=20
align=3Dtop><BR><IMG=20
src=3D"http://www.blogjava.net/Images/OutliningIndicators/None.gif"=20
align=3Dtop></SPAN> <SPAN style=3D"COLOR: #0000ff">import</SPAN> <SPAN=20
style=3D"COLOR: #000000">java.text.DateFormat;<BR><IMG=20
src=3D"http://www.blogjava.net/Images/OutliningIndicators/None.gif"=20
align=3Dtop></SPAN> <SPAN style=3D"COLOR: #0000ff">import</SPAN> <SPAN=20
style=3D"COLOR: #000000">java.util.Date;<BR><IMG=20
src=3D"http://www.blogjava.net/Images/OutliningIndicators/None.gif"=20
align=3Dtop><BR><IMG=20
src=3D"http://www.blogjava.net/Images/OutliningIndicators/None.gif"=20
align=3Dtop></SPAN> <SPAN style=3D"COLOR: #0000ff">import</SPAN> <SPAN=20
style=3D"COLOR: #000000">com.opensymphony.xwork2.ActionSupport;<BR><IMG=20
src=3D"http://www.blogjava.net/Images/OutliningIndicators/None.gif"=20
align=3Dtop><BR><IMG id=3DCodehighlighter1_165_389_Open_Image=20
onclick=3D"this.style.display=3D'none'; =
Codehighlighter1_165_389_Open_Text.style.display=3D'none'; =
Codehighlighter1_165_389_Closed_Image.style.display=3D'inline'; =
Codehighlighter1_165_389_Closed_Text.style.display=3D'inline';"=20
src=3D"http://www.blogjava.net/Images/OutliningIndicators/ExpandedBlockSt=
art.gif"=20
align=3Dtop><IMG id=3DCodehighlighter1_165_389_Closed_Image =
style=3D"DISPLAY: none"=20
onclick=3D"this.style.display=3D'none'; =
Codehighlighter1_165_389_Closed_Text.style.display=3D'none'; =
Codehighlighter1_165_389_Open_Image.style.display=3D'inline'; =
Codehighlighter1_165_389_Open_Text.style.display=3D'inline';"=20
src=3D"http://www.blogjava.net/Images/OutliningIndicators/ContractedBlock=
.gif"=20
align=3Dtop></SPAN> <SPAN style=3D"COLOR: #0000ff">public</SPAN> <SPAN=20
style=3D"COLOR: #000000"></SPAN><SPAN style=3D"COLOR: =
#0000ff">class</SPAN> <SPAN=20
style=3D"COLOR: #000000">HelloWorld </SPAN><SPAN=20
style=3D"COLOR: #0000ff">extends</SPAN> <SPAN style=3D"COLOR: =
#000000">ActionSupport=20
</SPAN><SPAN id=3DCodehighlighter1_165_389_Closed_Text=20
style=3D"BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; =
DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 =
1px solid; BACKGROUND-COLOR: #ffffff"><IMG=20
src=3D"http://www.blogjava.net/Images/dot.gif"> </SPAN><SPAN=20
id=3DCodehighlighter1_165_389_Open_Text><SPAN style=3D"COLOR: =
#000000">{<BR><IMG=20
src=3D"http://www.blogjava.net/Images/OutliningIndicators/InBlock.gif" =
align=3Dtop>=20
</SPAN> <SPAN style=3D"COLOR: #0000ff">private</SPAN> <SPAN =
style=3D"COLOR: #000000">String message;<BR><IMG=20
src=3D"http://www.blogjava.net/Images/OutliningIndicators/InBlock.gif" =
align=3Dtop>=20
<BR><IMG id=3DCodehighlighter1_222_243_Open_Image=20
onclick=3D"this.style.display=3D'none'; =
Codehighlighter1_222_243_Open_Text.style.display=3D'none'; =
Codehighlighter1_222_243_Closed_Image.style.display=3D'inline'; =
Codehighlighter1_222_243_Closed_Text.style.display=3D'inline';"=20
src=3D"http://www.blogjava.net/Images/OutliningIndicators/ExpandedSubBloc=
kStart.gif"=20
align=3Dtop><IMG id=3DCodehighlighter1_222_243_Closed_Image =
style=3D"DISPLAY: none"=20
onclick=3D"this.style.display=3D'none'; =
Codehighlighter1_222_243_Closed_Text.style.display=3D'none'; =
Codehighlighter1_222_243_Open_Image.style.display=3D'inline'; =
Codehighlighter1_222_243_Open_Text.style.display=3D'inline';"=20
src=3D"http://www.blogjava.net/Images/OutliningIndicators/ContractedSubBl=
ock.gif"=20
align=3Dtop> </SPAN> <SPAN style=3D"COLOR: =
#0000ff">public</SPAN> <SPAN=20
style=3D"COLOR: #000000">String getMessage() </SPAN><SPAN=20
id=3DCodehighlighter1_222_243_Closed_Text=20
style=3D"BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; =
DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 =
1px solid; BACKGROUND-COLOR: #ffffff"><IMG=20
src=3D"http://www.blogjava.net/Images/dot.gif"> </SPAN><SPAN=20
id=3DCodehighlighter1_222_243_Open_Text><SPAN style=3D"COLOR: =
#000000">{<BR><IMG=20
src=3D"http://www.blogjava.net/Images/OutliningIndicators/InBlock.gif" =
align=3Dtop>=20
</SPAN> <SPAN style=3D"COLOR: =
#0000ff">return</SPAN>=20
<SPAN style=3D"COLOR: #000000">message;<BR><IMG=20
src=3D"http://www.blogjava.net/Images/OutliningIndicators/ExpandedSubBloc=
kEnd.gif"=20
align=3Dtop> }</SPAN> </SPAN><SPAN style=3D"COLOR: =
#000000"><BR><IMG=20
src=3D"http://www.blogjava.net/Images/OutliningIndicators/InBlock.gif" =
align=3Dtop>=20
<BR><IMG=20
src=3D"http://www.blogjava.net/Images/OutliningIndicators/InBlock.gif" =
align=3Dtop>=20
@Override <BR><IMG =
id=3DCodehighlighter1_284_387_Open_Image=20
onclick=3D"this.style.display=3D'none'; =
Codehighlighter1_284_387_Open_Text.style.display=3D'none'; =
Codehighlighter1_284_387_Closed_Image.style.display=3D'inline'; =
Codehighlighter1_284_387_Closed_Text.style.display=3D'inline';"=20
src=3D"http://www.blogjava.net/Images/OutliningIndicators/ExpandedSubBloc=
kStart.gif"=20
align=3Dtop><IMG id=3DCodehighlighter1_284_387_Closed_Image =
style=3D"DISPLAY: none"=20
onclick=3D"this.style.display=3D'none'; =
Codehighlighter1_284_387_Closed_Text.style.display=3D'none'; =
Codehighlighter1_284_387_Open_Image.style.display=3D'inline'; =
Codehighlighter1_284_387_Open_Text.style.display=3D'inline';"=20
src=3D"http://www.blogjava.net/Images/OutliningIndicators/ContractedSubBl=
ock.gif"=20
align=3Dtop> </SPAN> <SPAN style=3D"COLOR: =
#0000ff">public</SPAN> <SPAN=20
style=3D"COLOR: #000000">String execute() </SPAN><SPAN=20
id=3DCodehighlighter1_284_387_Closed_Text=20
style=3D"BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; =
DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 =
1px solid; BACKGROUND-COLOR: #ffffff"><IMG=20
src=3D"http://www.blogjava.net/Images/dot.gif"> </SPAN><SPAN=20
id=3DCodehighlighter1_284_387_Open_Text><SPAN style=3D"COLOR: =
#000000">{<BR><IMG=20
src=3D"http://www.blogjava.net/Images/OutliningIndicators/InBlock.gif" =
align=3Dtop>=20
message </SPAN><SPAN style=3D"COLOR: =
#000000">=3D</SPAN>=20
<SPAN style=3D"COLOR: #000000"></SPAN><SPAN style=3D"COLOR: =
#000000">"</SPAN> <SPAN=20
style=3D"COLOR: #000000">Hello World, Now is </SPAN><SPAN=20
style=3D"COLOR: #000000">"</SPAN> <SPAN style=3D"COLOR: =
#000000"></SPAN><SPAN=20
style=3D"COLOR: #000000">+</SPAN> <SPAN=20
style=3D"COLOR: #000000">DateFormat.getInstance().format(</SPAN> <SPAN=20
style=3D"COLOR: #0000ff">new</SPAN> <SPAN style=3D"COLOR: =
#000000">Date());<BR><IMG=20
src=3D"http://www.blogjava.net/Images/OutliningIndicators/InBlock.gif" =
align=3Dtop>=20
</SPAN> <SPAN style=3D"COLOR: =
#0000ff">return</SPAN>=20
<SPAN style=3D"COLOR: #000000">SUCCESS;<BR><IMG=20
src=3D"http://www.blogjava.net/Images/OutliningIndicators/ExpandedSubBloc=
kEnd.gif"=20
align=3Dtop> }</SPAN> </SPAN><SPAN style=3D"COLOR: =
#000000"><BR><IMG=20
src=3D"http://www.blogjava.net/Images/OutliningIndicators/ExpandedBlockEn=
d.gif"=20
align=3Dtop>}</SPAN> </SPAN></DIV><SPAN=20
style=3D"FONT-SIZE: smaller; FONT-STYLE: italic">=E4=BE=8B1=20
classes/tutorial/HelloWorld.java</SPAN> <BR><BR>
<DIV=20
style=3D"BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; =
BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; =
PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; =
WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px =
solid; BACKGROUND-COLOR: #eeeeee"><SPAN=20
style=3D"COLOR: #0000ff"><</SPAN> <SPAN style=3D"COLOR: =
#800000">package=20
</SPAN><SPAN style=3D"COLOR: #ff0000">name</SPAN> <SPAN=20
style=3D"COLOR: #0000ff">=3D"ActionDemo"</SPAN> <SPAN=20
style=3D"COLOR: #ff0000">extends</SPAN> <SPAN=20
style=3D"COLOR: #0000ff">=3D"struts-default"</SPAN> <SPAN=20
style=3D"COLOR: #0000ff">></SPAN> <SPAN style=3D"COLOR: =
#000000"><BR> =20
</SPAN><SPAN style=3D"COLOR: #0000ff"><</SPAN> <SPAN=20
style=3D"COLOR: #800000">action </SPAN><SPAN style=3D"COLOR: =
#ff0000">name</SPAN>=20
<SPAN style=3D"COLOR: #0000ff">=3D"HelloWorld"</SPAN> <SPAN=20
style=3D"COLOR: #ff0000">class</SPAN> <SPAN=20
style=3D"COLOR: #0000ff">=3D"tutorial.HelloWorld"</SPAN> <SPAN=20
style=3D"COLOR: #0000ff">></SPAN> <SPAN style=3D"COLOR: =
#000000"><BR> =20
</SPAN><SPAN style=3D"COLOR: #0000ff"><</SPAN> =
<SPAN=20
style=3D"COLOR: #800000">result</SPAN> <SPAN style=3D"COLOR: =
#0000ff">></SPAN>=20
<SPAN style=3D"COLOR: #000000">/HelloWorld.jsp</SPAN> <SPAN=20
style=3D"COLOR: #0000ff"></</SPAN> <SPAN style=3D"COLOR: =
#800000">result</SPAN>=20
<SPAN style=3D"COLOR: #0000ff">></SPAN> <SPAN style=3D"COLOR: =
#000000"><BR> =20
</SPAN><SPAN style=3D"COLOR: #0000ff"></</SPAN> <SPAN=20
style=3D"COLOR: #800000">action</SPAN> <SPAN style=3D"COLOR: =
#0000ff">></SPAN>=20
<SPAN style=3D"COLOR: #000000"><BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff"></</SPAN> <SPAN style=3D"COLOR: =
#800000">package</SPAN>=20
<SPAN style=3D"COLOR: #0000ff">></SPAN> </DIV><SPAN=20
style=3D"FONT-SIZE: smaller; FONT-STYLE: italic">=E4=BE=8B1 =
classes/struts.xml=E4=B8=ADHelloWorld=20
Action=E7=9A=84=E9=85=8D=E7=BD=AE</SPAN> <BR><BR>
<P>=E5=9C=A8=E6=B5=8F=E8=A7=88=E5=99=A8=E5=9C=B0=E5=9D=80=E6=A0=8F=E4=B8=AD=
=E9=94=AE=E5=85=A5<A=20
href=3D"http://localhost:8080/Struts2_Action/HelloWorld.action">http://lo=
calhost:8080/Struts2_Action/HelloWorld.action</A>=EF=BC=8C=E5=8F=AF=E4=BB=
=A5=E7=9C=8B=E5=88=B0=E5=A6=82=E5=9B=BE1=E6=89=80=E7=A4=BA=E9=A1=B5=E9=9D=
=A2=E3=80=82</P><IMG=20
alt=3D"=E5=9B=BE1 HelloWorld=E8=BE=93=E5=87=BA=E9=A1=B5=E9=9D=A2"=20
src=3D"http://www.blogjava.net/images/blogjava_net/max/16539/r_img_1.gif"=
>=20
<BR><SPAN style=3D"FONT-SIZE: smaller; FONT-STYLE: italic">=E5=9B=BE1=20
HelloWorld=E8=BE=93=E5=87=BA=E9=A1=B5=E9=9D=A2</SPAN> =
<BR><BR>=E5=8F=82=E8=80=83JavaDoc=EF=BC=8C=E5=8F=AF=E7=9F=A5<A=20
href=3D"http://www.opensymphony.com/webwork/api/com/opensymphony/xwork/Ac=
tionSupport.html">ActionSupport</A>=E7=B1=BB=E5=AE=9E=E7=8E=B0=E4=BA=86=E6=
=8E=A5=E5=8F=A3=EF=BC=9A=20
<UL>
<LI><A=20
=
href=3D"http://www.opensymphony.com/webwork/api/com/opensymphony/xwork/Ac=
tion.html">com.opensymphony.xwork2.Action</A>
<LI><A=20
=
href=3D"http://www.opensymphony.com/webwork/api/com/opensymphony/xwork/Lo=
caleProvider.html">com.opensymphony.xwork2.LoaleProvider</A>
<LI><A=20
=
href=3D"http://www.opensymphony.com/webwork/api/com/opensymphony/xwork/Te=
xtProvider.html">com.opensymphony.xwork2.TextProvider</A>
<LI><A=20
=
href=3D"http://www.opensymphony.com/webwork/api/com/opensymphony/xwork/Va=
lidateable.html">com.opensymphony.xwork2.Validateable</A>
<LI><A=20
=
href=3D"http://www.opensymphony.com/webwork/api/com/opensymphony/xwork/Va=
lidationAware.html">com.opensymphony.xwork2.ValidationAware</A>
<LI>com.uwyn.rife.continuations.ContinuableObject=20
<LI><A=20
=
href=3D"http://java.sun.com/j2se/1.4/docs/api/java/io/Serializable.html">=
java.io.Searializable</A>
<LI><A=20
=
href=3D"http://java.sun.com/j2se/1.4/docs/api/java/lang/Cloneable.html">j=
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -