struts2已经是出来好久了, 觉得有必要对.NET与java的MVC模式进行以下比较:
先谈下struts2的原理,不过先来入门吧
1.先安装eclipse,我只会eclipse.
2.安装jdk,tomcat
3.下载struts2的库
4.新建一个eclipse java工程
选择tomcat project
输入工程名称:TestMvc
点击完成
5.引入struts库文件
复制这些文件到,相应目录,如下:
引入库之后,需要把它们列入编译路径中:
点add jar
把他们全部加入到编译环境中
6.搭建web.xml和struts.xml(为什么以后解释)
目录结构如下:(千万不能搞错了)
web.xml














struts.xml











7.AddAction.java











































8.测试
输入http://localhost:8080/TestMvc/add.jsp
输入123 和 456
结果
结束!
不好意思,实在是写的太简单了,改日分析一下,呵呵,睡觉了