文档详情

MyEclipse搭建SSH框架.docx

发布:2016-07-24约1.45千字共19页下载文档
文本预览下载声明
用MyEclipse搭建SSH框架 Struts2.1+Spring3.0+hibernate3.3 1、 配置Tomcat 配置Tomcat所在路径 配置Tomcat使用JDK版本 如果Tomcat为7.0则添加Tomcat-juli.jar包 2、 new一个web project。 2、右键项目,为项目添加Struts支持。 点击Finish。src目录下多了struts.xml配置文件。 3、使用MyEclipse DataBase Explorer建立数据源。 new一个数据源。填入数据源信息。 jdbc:Oracle:thin:@localhost(数据库所在服务器):1521(默认端口):orcl11(数据库名称) 点击test Driver,如果成功显示: 点击OK,点击Finish。 4、为项目添加Spring支持。 选择五个包,之后JAR Library Installation为如下图。 点击Next。 默认点击Finish。 5、为项目添加Hibernate支持。 默认的包,更改JAR Library Installation。 点击Next。 选择是建立Hibernate自己的配置文件,还是合并到Spring的配置文件。选择合并,即更改点选框,点击Next。 选择Existing Spring Configration File,点击Next。 选择我们刚刚创建的数据源。点击Next。 去掉复选框的勾勾,点击Finish。 6、在配置Tomcat路径下的 server.xml 在Host节点下添加: Context path=/Test docBase=D:/Java/Struts2.1+Spring3.0+hibernate3.3/WebRoot debug=0 privileged=true/Context 7、错误处理: 严重: Exception starting filter struts2 java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter MyEclipse 10安装目录 D:\WORK\MyEclipse\MyEclipse 10\configuration\org.eclipse.osgi\bundles\99\1\.cp\data\2.1\core Struts2所有Jar包复制到项目下的WEB-INF/lib文件夹里。 8、发布项目,此时已经可以访问这个项目的jsp页面了。 9、后续工作。 在web.xml里面加入spring配置与监听如下。 !-- Spring配置和监听start -- context-param param-namecontextConfigLocation/param-name param-value/WEB-INF/classes/application*.xml/param-value /context-param listener listener-classorg.springframework.web.context.ContextLoaderListener/listener-class /listener !—end -- 8、结束。
显示全部
相似文档