其實這個例子也是抄李剛《輕量級JavaEE企業應用實戰》裏的,學習中
1. 創建一個web project, 比如: Struts2Demo
2. 寫三個jsp,分別代表login, login正確,login錯誤.
(2.1) index.jsp
(2.2) error.jsp
(2.3) welcome.jsp
3. 在src文件夾建立兩個properties文件,messageResource_zh_CN.properties和messageResource.properties, 實現中文化
(3.1) messageResource_zh_CN.properties
(3.2) messageResource.properties
4. 在web.xml文件中定義Servlet或filter攔截用戶請求
web.xml
5. 定義處理用戶請求的Action類
6. 配置Action, 也就是配置src下的 struts.xml文件