如何在重定向时使用路径变量跳转到另一个控制器。
我尝试了以下方式,但出现以下错误:
java.lang.IllegalArgumentException: Model has no value for key 'formId'
我的实现方式:
Long formId = drugType.getFormId();
view = "redirect:/pub/req/customForm/view/{formId}";
并由控制器接收:
@RequestMapping(method = RequestMethod.POST, value = "/pub/req/customForm/view/{formId}")
String completeCustomForm(@PathVariable Long formId,
@Valid @ModelAttribute CustomFormLayout customFormLayout,
BindingResult errors, HttpServletRequest request, Model model,
RedirectAttributes attr) {
有什么想法可以将表单ID值重定向到此控制器吗?