SSH框架搭建

1.spring + hibernateORM

application-data.xml 配置文件

1.jar包的引入

2.扫描dao, service层

   将数据源(连接池)和sessionFactory放入springIOC容器

3.将sessionFactory委托给我们的spring进行事务管理



	
	
	
	
	
		
	
	
	
	
		
		
		
			
	
	
	
	
		
		
		
		
			
				org.hibernate.dialect.MySQLDialect
				true
				true
				update
			
		
		
		
	
	
	
	
	
		
	
	
	
		
	
	

2.springMVC整合进来

springMVC-servlet.xml

1.导入springMVC所用的包

2.编写springMVC的配置文件 扫描controller

3.注意: 在web.xml当中 设置DispatcherServlet这个servlet

   来保证springMVC可以运行工作



	
													
	
	
	
	
	    	
	    	
	    
	    
    
    
    
	
	
	
	
	
		
		
			
			
			
		
		
	
	
	
	
    		
    		
    		
    	
	

3.配置web.xml   设置Spring的监听器

web.xml



  SpringMVCsh
  
    index.html
    index.htm
    index.jsp
    default.html
    default.htm
    default.jsp
  
  
  
  
  		contextConfigLocation
		classpath:application*.xml
  
  
  
  	org.springframework.web.context.ContextLoaderListener
  
  
  
    spring
    org.springframework.web.servlet.DispatcherServlet
    
      contextConfigLocation
      classpath:spring-servlet.xml
    
    1
  
  
    spring
    /
  

SSH框架搭建用到的所有包:

链接: https://pan.baidu.com/s/1uGucDHW5An-utVE7-LsCTA 密码: jrgr

你可能感兴趣的:(SSH框架搭建)