您当前的位置: 首页 >  spring

星夜孤帆

暂无认证

  • 1浏览

    0关注

    626博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

SpringMVC基础-01-SpirngMVC简单流程

星夜孤帆 发布时间:2019-04-20 18:12:27 ,浏览量:1

配置pom.xml文件

  4.0.0
  com.monkey1024
  02mvc
  0.0.1-SNAPSHOT
  war
  
        
            junit
            junit
            3.8.1
            test
        
        
            javax.servlet
            javax.servlet-api
            3.1.0
        
        
            org.springframework
            spring-webmvc
            5.0.4.RELEASE
        

    
    
    	
        02mvc
        
            
            
                org.apache.maven.plugins
                maven-compiler-plugin
                
                    
                    1.8
                    1.8
                    UTF-8
                
            
        
    
 配置web.xml


	 

	
	
		springMVC
		
		org.springframework.web.servlet.DispatcherServlet
		
			contextConfigLocation
			classpath:springmvc.xml
		
		1
	
	
		springMVC
		/
	
配置springmvc.xml



	
    
	
	
	
		
		
	
	
	
	

 
 HelloSpringMVC.java
package com.monkey1024.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

public class HelloSpringMVC implements Controller {

	@Override
	public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView();
		mv.addObject("hello","hello first spring mvc");
		mv.setViewName("first");
		return mv;
	}

}
first.jsp




Insert title here


${hello}

 

关注
打赏
1636984416
查看更多评论
立即登录/注册

微信扫码登录

0.0399s