三大框架的整合

第一步 导包(包括28个ssh包,数据库驱动包除外)

 

第二步 配置文件的准备

  与struts2相关的配置文件

    web.xml

            struts2 org.apache.struts2.dispatcher.FilterDispatcher struts2 /*

   struts.xml ------配置action

     注:配置action时要特别注意此处action的class不再是action类的包名+类名,而是在spring中的applicationContext.xml中配置的action的bean的id

    struts.properties  ------修改resources 设置成本地资源文件

 

与spring相关的配置文件

  web.xml ----添加监听

              ContextLoaderListener org.springframework.web.context.ContextLoaderListener

applicationContext.xml

  注意:在windows下不区分大小写,但在Linux下区分,首字母要小写

struts.properties---关联struts和spring

    struts.objectFactory = spring,此设置也可以在struts.xml中配置

      

 

与hibernate相关的配置文件

   web.xml

        contextConfigLocation /WEB-INF/classes/applicationContext.xml

   ssh整合时,hibernate.cfg.xml就用不着了(我是这样理解的)

第三步 关联

   spring与hibernate关联

        hibernate/MemberBean.hbm.xml

 

 

其他设置:

   在applicationContext.xml中进行的属性注入

  

这是主要的配置,具体的没有写完,我把项目也传上去!!

 

 

 

 

 

你可能感兴趣的:(三大框架,框架,spring,hibernate,action,struts,sqlserver)