Java+Spring: SEVERE Servletservice

前端 未结 4 1183
孤街浪徒
孤街浪徒 2021-01-17 04:14

I dont know what is wrong in my listContacts in controller map.put(\"contactList\", contactService.listContact()); Can somebody help me?

4条回答
  •  渐次进展
    2021-01-17 04:35

    It looks like a NullPointerException thrown in the method here:

    @RequestMapping("/contact")
    public String listContacts(Map map) {
        map.put("contact", new Contact());
        map.put("contactList", contactService.listContact());       
    
        return "/contact";
    }
    

    I would debug and check that contactService has been autowired correctly.

    The null pointer is line 26, if that is the line containing contactService.listContact() then contactService is null. If it is the line above then the map is null.

    I am not sure but try adding:

    to the dispatcher-servlet.xml as well, it could be that the annotation isnt getting processed

提交回复
热议问题