Questions tagged «httpverbs»


3
在Spring中结合GET和POST请求方法
我有同时支持GET和POST请求的资源。这里是示例资源的示例代码: @RequestMapping(value = "/books", method = RequestMethod.GET) public ModelAndView listBooks(@ModelAttribute("booksFilter") BooksFilter filter, two @RequestParam parameters, HttpServletRequest request) throws ParseException { LONG CODE } @RequestMapping(value = "/books", method = RequestMethod.POST) public ModelAndView listBooksPOST(@ModelAttribute("booksFilter") BooksFilter filter, BindingResult result) throws ParseException { SAME LONG CODE with a minor difference } 这两个方法中的代码实际上是相同的,除了可以说一个变量定义。可以使用method = {RequestMethod.POST, …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.