-2

I proceeding Android studio - Spring by XML parsing,with the below error :

HTTP Status 500 - Request processing failed; nested exception is java.lang.IllegalStateException: An Errors/BindingResult argument is expected to be declared immediately after the model attribute, the @RequestBody or the @RequestPart arguments to which they apply: ..... . . . Spring is

Code

@RequestMapping(value = "/boardToMyXml")
@ResponseBody
public XmlDataList MyXml( Errors errors,HttpSession session, HttpServletRequest request, 
            Model model, HttpServletResponse response) {
        String id = request.getParameter("id");
        String pw = request.getParameter("pw");
        AuthInfo authInfo = authService.authenticate(id, pw);
        int userNum =authInfo.getUserNum();
        model.addAttribute("id", id);
        model.addAttribute("pw", pw);
        model.addAttribute("userNum", userNum);
        List<Data> listm = boardDao.xmlMyBoardList(userNum);
        System.out.println(listm);

        return new XmlDataList(listm);
    }
Keshav Pradeep Ramanath
  • 1,623
  • 4
  • 24
  • 33

1 Answers1

0

I believe Errors errors should be added as parameter when @Valid, @ModelAttribute annotations are used for any other parameter in the method signature. Please have look at the below stackoverflow answers

An Errors/BindingResult argument is expected to be declared immediately after the model attribute, the @RequestBody or the @RequestPart arguments

Errors/BindingResult argument is expected

Community
  • 1
  • 1
Williams
  • 61
  • 3
  • edit this, public XmlDataList MyXml(HttpServletRequest request, HttpSession session) { String id = request.getParameter("id"); .................. – Mi-kyoung Seo Apr 25 '17 at 07:54