zoukankan      html  css  js  c++  java
  • springmvc

    代码:

    @ResponseBody
        @RequestMapping("/hello3/{hello}")
        public String hello3(@PathVariable String hello) {
            return hello;
        }

     代码:

    package com.logan.SpringBootDemo01.controller;
    
    import org.springframework.stereotype.Controller;
    import org.springframework.web.bind.annotation.PathVariable;
    import org.springframework.web.bind.annotation.RequestMapping;
    import org.springframework.web.bind.annotation.RequestParam;
    import org.springframework.web.bind.annotation.ResponseBody;
    
    @Controller
    public class MyController {
        
        @ResponseBody
        @RequestMapping("/hello")
        public String hello() {
            return "hello";
        }
        
        @ResponseBody
        @RequestMapping("/hello1")
        public String hello1() {
            return "hello1";
            
        }
        
        @ResponseBody
        @RequestMapping("/hello2")
        public String hello2() {
            return "hello2";
        }
        
        @ResponseBody
        @RequestMapping("/hello3/{hello}")
        public String hello3(@PathVariable String hello) {
            return hello;
        }
        
        @ResponseBody
        @RequestMapping("/hello4")
        //可以这样访问http://localhost:8080/hello4?type1=2&type=3
        public int hello4(@RequestParam int type) {
            return type;
        }
        
    
    }
  • 相关阅读:
    【数据结构】树的DFS序&欧拉序
    Codeforces 1335E2
    Codeforces 1335E1
    Codeforces 1338A/1339C
    【数据结构】ST算法
    Codeforces 1334C
    Codeforces 1333D
    Codeforces 1333C
    python中的socket编程实例与查看端口占用
    java中打印数组
  • 原文地址:https://www.cnblogs.com/LoganChen/p/13208741.html
Copyright © 2011-2022 走看看