struts2-blank-2.0.11.1.war
web.xml:
index.html:
??? < head >
??? ??? <!-- ?利用html?跳轉(zhuǎn)? -->
??? ??? < META? HTTP-EQUIV ="Refresh" ?CONTENT ="0;URL=example/HelloWorld.action" >
??? </ head >
struct.xml
??? <!-- ?模塊化注入?? -->
??? < include? file ="example.xml" />
???? <!-- ?Add?packages?here? -->
????
example.xml
web.xml:
<?
xml?version="1.0"?encoding="UTF-8"
?>
< web-app? id ="WebApp_9" ?version ="2.4" ?xmlns ="http://java.sun.com/xml/ns/j2ee" ?xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance" ?xsi:schemaLocation ="http://java.sun.com/xml/ns/j2ee?http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >
???? < display-name > Struts?Blank </ display-name >
???? < filter >
???????? < filter-name > struts2 </ filter-name >
????????
??? <!-- ?struct?2?處理類? -->
??? <!-- 相應(yīng)需要jar:
??? ??? ??? ??? commons-logging-1.0.4.jar
??? ?? ?? ?? ?? freemarker-2.3.8.jar
??? ?? ?? ?? ?? ognl-2.6.11.jar
??? ??? ??? ??? struts2-core-2.0.11.1.jar
??? ?? ?? ?? ?? xwork-2.0.4.jar
??? --> < filter-class > org.apache.struts2.dispatcher.FilterDispatcher </ filter-class > </ filter >
???? <!-- ??默認(rèn)覆蓋 全部 路徑? -->
???? < filter-mapping >
???????? < filter-name > struts2 </ filter-name >
???????? < url-pattern > /* </ url-pattern >
???? </ filter-mapping >
???? <!-- ?初始頁面? -->
???? < welcome-file-list >
???????? < welcome-file > index.html </ welcome-file >
???? </ welcome-file-list >
</ web-app >
< web-app? id ="WebApp_9" ?version ="2.4" ?xmlns ="http://java.sun.com/xml/ns/j2ee" ?xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance" ?xsi:schemaLocation ="http://java.sun.com/xml/ns/j2ee?http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >
???? < display-name > Struts?Blank </ display-name >
???? < filter >
???????? < filter-name > struts2 </ filter-name >
????????
??? <!-- ?struct?2?處理類? -->
??? <!-- 相應(yīng)需要jar:
??? ??? ??? ??? commons-logging-1.0.4.jar
??? ?? ?? ?? ?? freemarker-2.3.8.jar
??? ?? ?? ?? ?? ognl-2.6.11.jar
??? ??? ??? ??? struts2-core-2.0.11.1.jar
??? ?? ?? ?? ?? xwork-2.0.4.jar
??? --> < filter-class > org.apache.struts2.dispatcher.FilterDispatcher </ filter-class > </ filter >
???? <!-- ??默認(rèn)覆蓋 全部 路徑? -->
???? < filter-mapping >
???????? < filter-name > struts2 </ filter-name >
???????? < url-pattern > /* </ url-pattern >
???? </ filter-mapping >
???? <!-- ?初始頁面? -->
???? < welcome-file-list >
???????? < welcome-file > index.html </ welcome-file >
???? </ welcome-file-list >
</ web-app >
index.html:


??? < head >
??? ??? <!-- ?利用html?跳轉(zhuǎn)? -->
??? ??? < META? HTTP-EQUIV ="Refresh" ?CONTENT ="0;URL=example/HelloWorld.action" >
??? </ head >


struct.xml


??? <!-- ?模塊化注入?? -->
??? < include? file ="example.xml" />
???? <!-- ?Add?packages?here? -->
????


example.xml
<?xml?version="1.0"?encoding="UTF-8"??>
<!DOCTYPE?struts?PUBLIC
????????"-//Apache?Software?Foundation//DTD?Struts?Configuration?2.0//EN"
????????"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
????<!--?定義域空間?-->
????<package?name="example"?namespace="/example"?extends="struts-default">
????????<!--?域一般訪問?-->
????????<action?name="HelloWorld"?class="example.HelloWorld">
????????????<result>/example/HelloWorld.jsp</result>
????????</action>
<!--HelloWord.java(國(guó)際化) start -->
<!--HelloWord.java(國(guó)際化) end-->
???????<!--?(關(guān)鍵:action利用正則選擇方法)Login(_*)? >method="{1}"? -->
????????<action?name="Login_*"?method="{1}"?class="example.Login">
????????????<result?name="input">/example/Login.jsp</result>
????????????<result?type="redirect-action">Menu</result>
????????</action>
<!-- example.Login(驗(yàn)證框架) start -->
java
Login-validation.xml

<!-- example.Login(驗(yàn)證框架) end -->
????????<!--?jsp?封包 如:Missing.action就是Missiong.jsp -->
????????<action?name="*"?class="example.ExampleSupport">
????????????<result>/example/{1}.jsp</result>
????????</action>
????????<!--?Add?actions?here?-->
????</package>
</struts>
<!DOCTYPE?struts?PUBLIC
????????"-//Apache?Software?Foundation//DTD?Struts?Configuration?2.0//EN"
????????"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
????<!--?定義域空間?-->
????<package?name="example"?namespace="/example"?extends="struts-default">
????????<!--?域一般訪問?-->
????????<action?name="HelloWorld"?class="example.HelloWorld">
????????????<result>/example/HelloWorld.jsp</result>
????????</action>
<!--HelloWord.java(國(guó)際化) start -->

???????<!--?(關(guān)鍵:action利用正則選擇方法)Login(_*)? >method="{1}"? -->
????????<action?name="Login_*"?method="{1}"?class="example.Login">
????????????<result?name="input">/example/Login.jsp</result>
????????????<result?type="redirect-action">Menu</result>
????????</action>
<!-- example.Login(驗(yàn)證框架) start -->
java


<!-- example.Login(驗(yàn)證框架) end -->
????????<!--?jsp?封包 如:Missing.action就是Missiong.jsp -->
????????<action?name="*"?class="example.ExampleSupport">
????????????<result>/example/{1}.jsp</result>
????????</action>
????????<!--?Add?actions?here?-->
????</package>
</struts>