struts2的第一个程序 helloworld!

1.下载struts2

struts2的第一个程序 helloworld!

2.创建project----》struts2

struts2的第一个程序 helloworld!

3.将struts2-blank.war后缀改成.zip之后解压

struts2的第一个程序 helloworld!

4.在/struts2/WebContent/WEB-INF/下创建lib文件,并将\struts-2.3.37-all\struts-2.3.37\apps\struts2-blank\WEB-INF\lib里的jar包复制过来

struts2的第一个程序 helloworld!

5.配置web.xml文件,可拷贝struts2-blank\WEB-INF\web.xml中的内容

struts2的第一个程序 helloworld!

6.将struts2-blank\WEB-INF\src\java\struts.xml拷贝到项目的src路径下

struts2的第一个程序 helloworld!

 

7.在src下创建HelloAction

struts2的第一个程序 helloworld!

8.创建hello.jsp页面

struts2的第一个程序 helloworld!

struts2的第一个程序 helloworld!

9.在struts.xml中配置HelloAction,需要注意namespace前需要加/

struts2的第一个程序 helloworld!

10.启动tomcat,运行程序

struts2的第一个程序 helloworld!

归纳总结:

1.配置action的namespace前一定要加/。

2.注意action的class配置