IDEA/SpringMVC/jetty/Maven

1.创建项目


捕获.PNG

2.项目架构


捕获2.PNG

3.pom.xml




  4.0.0

  com.itcast.myspring
  myspring
  1.0-SNAPSHOT
  war

  myspring Maven Webapp
  
  http://www.example.com

  
    UTF-8
    1.7
    1.7
    4.3.20.RELEASE
  

  
    
      junit
      junit
      4.11
      test
    
    
    
      org.springframework
      spring-beans
      ${spring.version}

    
    
    
      org.springframework
      spring-context
      ${spring.version}
    
    
    
      org.springframework
      spring-core
      ${spring.version}
    
    
    
      org.springframework
      spring-expression
      ${spring.version}
    
    
      org.springframework
      spring-web
      ${spring.version}
    
    
      org.springframework
      spring-webmvc
      ${spring.version}
    
  


  
    myspring
    
      
        
          maven-clean-plugin
          3.1.0
        
        
        
          maven-resources-plugin
          3.0.2
        
        
          maven-compiler-plugin
          3.8.0
        
        
          maven-surefire-plugin
          2.22.1
        
        
          maven-war-plugin
          3.2.2
        
        
          maven-install-plugin
          2.5.2
        
        
          maven-deploy-plugin
          2.8.2
        
        
          org.eclipse.jetty
          jetty-maven-plugin
          9.4.14.v20181114
        
      
    
  

4.创建jsp
5.创建controller

@Controller
@RequestMapping("/home")

public class HomeController {

    //映射一个action
    @RequestMapping("/index")
    public  String index(){
        //返回一个视图
        return "itemList";
    }
}

6.applicationContext-mvc.xml




    

    
    
    
    
        
        
        
    


7.web.xml




    springmvc
    org.springframework.web.servlet.DispatcherServlet
    
        contextConfigLocation
        
        classpath:applicationContext-mvc.xml
    
    1
  

  
    springmvc
    /
  

8.请求
http://localhost:8080/myspring/home/index

你可能感兴趣的:(IDEA/SpringMVC/jetty/Maven)