Spring MVC

一、Spring MVC的工作原理:

Paste_Image.png

二、加相关的Jar包

spring-web
javax.servlet-api - 多加provided
jstl

三、web.xml的配置:

 
    contextConfigLocation
    classpath:app.xml



    enc
    org.springframework.web.filter.CharacterEncodingFilter
    
        encoding
        utf-8
    
    
        forceEncoding
        true
    


    enc
    /*   




    dispatcher
    org.springframework.web.servlet.DispatcherServlet
  

    dispatcher
    /



    org.springframework.web.context.ContextLoaderListener

四、XXX-servlet.xml的配置:XXX对应web里面的dispatcher

  









    
    
    




  

    
    
    
        
            true
        
    




    
    
    






    
    
        
        
        
    



 

    
        
         
            
    

注意:和web.xml放一起

五、XXX.xml的配置-app对应web.xml中classpath:app.xml

 


    

    
    
    
    

    
    
    
    
    


    



    


你可能感兴趣的:(Spring MVC)