zoukankan      html  css  js  c++  java
  • spring: @RequestMapping注解

    处理GET/POST请求方法

    1.常用的:

    import org.springframework.web.bind.annotation.RequestMapping;
    
    @Controller
    public class HomeController {
    
    	
    	//处理"/"的GET请求方法1
    	@RequestMapping(value="/",method=GET)	
    	public String home()
    	{
    		return "home";
    	}
    }
    

      

    2常用方法

    import org.springframework.web.bind.annotation.RequestMapping;
    
    @Controller
    //处理"/"的GET请求方法2
    @RequestMapping("/")
    public class HomeController {
    	
    	
    	//处理"/"的GET请求方法2
    	@RequestMapping(method=GET)
    	public String home()
    	{
    		return "home";
    	}
    }
    

      

    3.常用方法,数组

    import org.springframework.web.bind.annotation.RequestMapping;
    
    @Controller
    @RequestMapping({"/","/homepage"})
    public class HomeController {
    	
    	
    	public String home()
    	{
    		return "home";
    	}
    }
    

      

  • 相关阅读:
    js中replace的正则替换
    ios沙盒路径
    Android开源框架
    小知识点
    __NSCFConstantString && __NSPlaceholderDictionary
    iq 格式分析
    C 函数
    Xcode报错
    XMPP Server
    H5网站借鉴
  • 原文地址:https://www.cnblogs.com/achengmu/p/8328364.html
Copyright © 2011-2022 走看看