pom.xml 導入 struts2 座標
struts2 基本開發
Struts2 和 spring 整合
Struts2 註解開發
struts2-convention-plugin
struts-plugin.xml
配置掃描 struts2 Action 類
指定後綴的類
struts2 註解
類上
@ParentPackage 包基礎誰? extends=”struts-default”
@Namespace 包命名空間 namespace=”/”
@Actions struts2 的 Action 配置,用於配置多個 Action
方法上
@Action 配置訪問路徑,和方法綁定
@Result 結果集配置
l
struts2 和 spring 整合
struts2 的 Action 使用 spring 註解,被 spring 管理
@Controller spring 表現層 bean
@Scope 配置 Action 爲多例
錯誤: 忘記配置 struts2 核心過濾器
web.xml
思考:爲什麼 Action 處理請求,轉發回頁面會顯示空白 ?
設置 type=”redirect” 重定向回頁面解決問題