eclipse整合SSH框架-配置Spring-集成SSH

2025-11-22 08:33:18

1、导入Spring的jar包。需要aop,beans,context,core,expression,jdbc,orm,tx,web以及导入spring和struts2集成包Struts2-spring-plugin-2.3.15.jar

eclipse整合SSH框架-配置Spring-集成SSH

2、所有需要的jar包,如下图所示。

eclipse整合SSH框架-配置Spring-集成SSH

3、下面需要把Hibernate的SessionFactory交给Spring去管理,配置文件如下。

eclipse整合SSH框架-配置Spring-集成SSH

4、再把Hibernate的配置文件注释掉,代码如下。

eclipse整合SSH框架-配置Spring-集成SSH

5、再配置web.xml,代码如下。

eclipse整合SSH框架-配置Spring-集成SSH

6、然后编写jsp页面,先创建一个student文件夹,再创建jsp文件。

eclipse整合SSH框架-配置Spring-集成SSH

7、jsp页面代码如下。

eclipse整合SSH框架-配置Spring-集成SSH

8、再编写StuAction,代码如下。

eclipse整合SSH框架-配置Spring-集成SSH

9、编写Service代码。

eclipse整合SSH框架-配置Spring-集成SSH

eclipse整合SSH框架-配置Spring-集成SSH

10、编写Dao代码。

eclipse整合SSH框架-配置Spring-集成SSH

eclipse整合SSH框架-配置Spring-集成SSH

11、把项目添加到tomcat,并启动。

eclipse整合SSH框架-配置Spring-集成SSH

12、启动浏览器,输入访问地址。

eclipse整合SSH框架-配置Spring-集成SSH

13、点击添加学生按钮,看看数据库和页面以及控制台的日志。

eclipse整合SSH框架-配置Spring-集成SSH

eclipse整合SSH框架-配置Spring-集成SSH

eclipse整合SSH框架-配置Spring-集成SSH

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢