xml 配置大都是通過 複製 貼上 修改 得到。
其中此處
永遠是/*
<
url-pattern
>
/*url-pattern
>
struts.xml 內
<
action
name
="hello"
>
action 一般用小寫。
xml 內寫**時內自動提示設定: (!原始檔路徑不能有中文。)
此處複製了乙份dtd檔案到d:\myecliipse資料夾下。
如果不自動提示則按快捷鍵alt+/。
當tomcat收到乙個請求時,會在web.xml內發現乙個
struts2filter-name>
org.apache.struts2.dispatcher.ng.filter.strutsprepareandexecutefilterfilter-class>
filter>
struts2filter-name>
/*url-pattern>
他會過濾所有的url位址 (/*)例如:但我們當我們輸入hell時他會查struts裡面的
="default"namespace
="/"extends
="struts-default">
的namespace
="/"
/後面是hell 接下來回查
="hell">
裡面有沒有hell 如果有則會找裡面對應到的result
/hello.jsp
result>
返回hell.jsp
Struts2學習筆記
1.不繼承,不介面 2.繼承actionsupport類 3.介面action介面 4.我們可以使用modeldriven模式 5.我們可以自己編寫bean進行struts2的擴充套件,但是 一般不需要,因為struts2的功能已經很強大了!6.我們可以將default.properties檔案中的...
Struts2學習筆記
structs修改後自動更新 action執行的時候並不一定要執行execute方法 method add user add success.jsp user add success.jsp 可以在配置檔案中配置action的時候用method 來指定執行哪個方法 user useradd 新增使用...
struts2 學習筆記
在struts.xml中配置的action,訪問路徑是http ip port 工程名 action名 package節點的名稱對url沒有影響,只有namespace在存在同名action的情況下會有影響。因為struts尋找action的方式是首先按照action的url中,action名稱之前...