我已经编写了一个控制器类,其中我正在编写一个请求映射方法,该方法又将调用另一种具有请求映射的方法(但这次使用一些路径变量)
遇到异常:java.lang.NumberFormatException:对于输入字符串:“{50}”
Controller class :
@Controller
public class CompanyController {
....other code.........
@RequestMapping("/companySave.do")
public String saveCompany(Map<String, Object> map, @ModelAttribute("company")
Company company, BindingResult result)
{
map.put("success", "success");
companyService.saveCompany(company);
return "redirect:/companyAddressSave/{"+company.getId()+"}.do";
}
@RequestMapping("/companyAddressSave/{id}.do")
public String saveAddressCompany(@PathVariable("id") String id,Map<String, Object> map, @ModelAttribute("company")
Company company, BindingResult result)
{ map.put("Success", "Success");
map.put("company", companyService.getCompany(Long.parseLong(id)));
System.out.println("Hi");
return "add-compnay-master";
}
}
任何人都可以告诉我在传递路径变量时我是否犯了任何错误..??? 提前致谢..!