01-项目的建立以及配置文件的修改

阅读更多
     此篇博文仅代表个人观点,由于本人经验尚浅,如有错漏之处请私信指正,谢谢
先期准备工作:
   1:下载spring-framework-3.x.x.zip,以及hibernate-4.2.x.zip,并下载spring相关依赖包。
   2:创建web工程,将相关的jar导入到lib下
   3:创建源文件夹resource,将相关配置文件放到该文件夹下,以便统一管理
   4:打开web.xml文件,编辑

  	Demo	
   	
    
        log4jConfigLocation
        /WEB-INF/classes/log4j.properties
    
    
        log4jRefreshInterval
        600000
    

    
        org.springframework.web.util.Log4jConfigListener
    
    

    
     
    
        Set Character Encoding
        org.springframework.web.filter.CharacterEncodingFilter
        
            encoding
            UTF-8
        
        
            forceEncoding
            true
        
    

    
        Set Character Encoding
        /*
    
    
    
    
         
    
        contextConfigLocation
        
            classpath:spring.xml
        
    

    
        
            org.springframework.web.context.ContextLoaderListener
        
    
    
    
     
        SpringMVC
        org.springframework.web.servlet.DispatcherServlet
        
            contextConfigLocation
            classpath:spring-mvc.xml
        
        1
    

    
        SpringMVC
        /
    
  
	
	
		default
		*.css
	
	
		default
		*.js
	
	
		default
		*.json
	
	
		default
		*.gif
	
	
		default
		*.png
	
	
		default
		*.jpg
	
	
		default
		*.ico
	
	
		default
		*.doc
	
	
		default
		*.xls
	
	
		default
		*.docx
	
	
		default
		*.xlsx
	
	
		default
		*.txt
	
	
		default
		*.swf
	
  

	
	
		15
	
    
	
		404
		/error/404.jsp
	
	
	
		500
		/error/500.jsp
	
    
    
  
    index.jsp
  


    5:将spring提供的配置文件applicationContext.xml改名为spring.xml提供本人的配置


    
 
   
	

    
        
            
                classpath:resources.properties
            
        
    

    
    
        
            
                
                classpath:messages
            
        
        
        
    
    

  	
  		
		
		
		
	

  	
    	
    	
			
				cn.cy
			
		
        
            
                 org.hibernate.dialect.Oracle10gDialect
                true
                true
                update
                none
                org.springframework.orm.hibernate4.SpringSessionContext
            
        
  	


    
	
	
	
  	

    
        
    

    
        
         	
			
			
			
			
			
			
			
			
			

			
			
			
			
			

			
        
    
    
        
        
        
    

 
    6:更改spring-servlet.xml文件名改为spring-mvc.xml,提供本人项目中的仅供参考

    
   
    
    
    
        
            
                
           	
             
            
                
            
        
        
    

    
        
        
        
    
   
     
		
    
    
    
		
    


   
    
   
         
  	
	
      
    
    
    
        
        
    
     
    
    
        
              
                  
                        error_all
                
            
        
    




    进行如上操作后,即可进行springmvc+hibernate的开发了,开发示例请参考我的下一篇文章

你可能感兴趣的:(hibernate,spring,springmvc,jquery)