Struts2入门之HelloWorld
Struts2入门之HelloWorld
1、下载Struts2
下载地址:http://struts.apache.org/
推荐使用struts-2.3.24,此版本较稳定。
2、新建Web项目
3、导入jar包
将下载的struts-2.3.24解压之后进入apps文件夹下,将里面后缀名为.war的文件复制一份,将其后缀名该为.zip。
对其解压,在WEB-INF\lib中可取得struts的13个常用jar包,将其复制到自己项目的lib文件夹中即可。
4、新建jsp页面
5、创建Action类
6、配置web.xml
配置struts自己定义的过滤器来处理请求。
此过滤器在struts的核心jar包中:
在web.xml中配置过滤器:
7、配置struts.xml
8、部署到tomcat
9、运行分析
敬请路过的大牛们,指点指正!!!