安装完MyEclipse2015后,进入菜单Help->MyEclipse Learning Center,在界面里的搜索框里输入:struts
Web Development
根据指导来开发第一个使用Struts框架的网络应用。
但是在使用过程中发觉这个例子里的跟具体代码还是有些对不上,有些是错的。
比如:
1. <package name="login" namespace="/loginns" extends="struts-default">
使用图形界面来创建Package时,
extends="struts-default"是加入不进去的。
2. 创建redirectAction连接,不是按说明的方法创建的。
出现这些问题请参考struts代码里待的例子。
我们需要一个完整的例子来比较,下载struts的最新源码:
struts-2.3.24.1。里面有几个例子,
struts-2.3.24.1/src/apps/blank。
写完以后,我们可以运行这个例子:
Right-click MyBlogStruts2Example, and select Run As>MyEclipse Server Application. Select the MyEclipse Tomcat Server. The project deploys, the server starts, and the the index.jsp page opens in the browser.
能够正常运行。
基本上可以了解一些类似网站的架构:JSP显示页面,java控制后台逻辑。
如果想了解的更详细些,可以找一些开源的代码来研究,比如Google的代码管理软件Gerrit。