还有一种通过路径传输参数,效果如下
实现:
package com.aurora.path; 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.ResponseBody; @Controller @RequestMapping("path") @ResponseBody public class PathController { // path/账号/密码 // 接收路径参数,String account,String password ->接收param格式参数 @RequestMapping("{account}/{password}") public String login(@PathVariable(value = "account") String username, @PathVariable String password){ System.out.println("username = " + username + ", password = " + password); return "username = " + username + ", password = " + password; } }
标签:username,String,SpringMVC,路径,springframework,传收,org,import,password From: https://www.cnblogs.com/rsy-bxf150/p/17788078.html