1.struts是mvc模式的經典應用。它主要是提供乙個好的控制器和一套定製的標籤庫
優點:結構層次分明,高重用性。
2.開發環境搭建
建立乙個struts1的工程,匯入struts1的jar包
在web-inf目錄中新增乙個struts-config.xml,
配置web.xml檔案中新增處理struts動作的actionservlet配置
action
org.apache.struts.action.actionservlet
config
/web-inf/struts-config.xml
0*.do
3.使用struts1開發乙個簡單登入示例
建立loginform類,這個類的作用是儲存jsp頁面提交的資料
public class loginform extends actionform
public void setname(string name)
public string getpassword()
public void setpassword(string password)
}並在struts-config.xml檔案中配置
Struts1 學習筆記1 struts0100
action 單例項 單例 多執行緒使用時如果有可以修改的成員屬性要注意執行緒安全 actionform一般是粗粒度的,一般乙個模組對應乙個actionform action actionform 兩個屬性 username password 注意actionform裡面的兩個方法 配置檔案 log...
struts1學習筆記一
使用者註冊案例 1.寫乙個register.jsp頁面 2 匯入struts開發包,在web.xml中配置struts寫的 actionservlet,讓它處理所有的.do請求。actionservlet org.apache.struts.action.actionservlet config w...
struts1學習筆記二
action和actionform的重用 1 actionform的重用 a 使用dynaactionform減少actionform原始檔數量,便於 維護 b 多個請求使用同乙個actionform 2 action的重用 a dispachaction 通過引數值識別不同的請求 1 action...