【发布时间】:2018-04-15 21:41:27
【问题描述】:
我是 Spring 和 Springboot 方面的新手,某些方面对我来说仍然很神奇。是否可以从先前 URL 的表单自动将参数传递给 URL?问题是:
我在localhost:8080/login-page 填写了用户名和密码。例如。 johny123 / pass123.
然后我希望它移动到 URL 地址localhost:8080/user=johny213。
我一直在寻找答案,我认为@RequestParam 无法解决问题。
@PostMapping("/user={userId}")
public ModelAndView loginUser(@RequestParam ("userId") String userID, @ModelAttribute ("user") User user){
creating MAV, code code code, returning MAV
}
问题是,我不想在 URL 中输入参数,我希望它们从表单中自动传递。我没有展示更多代码,因为我只需要一个大致的想法和提示如何实现它。
【问题讨论】:
标签: java spring spring-boot