How to populate dropdown box in Spring MVC

后端 未结 3 2171
没有蜡笔的小新
没有蜡笔的小新 2020-12-15 10:14

I have been trying to find out how to populate a dropdown box in Spring MVC. There are a few threads out there on this subject but none of them that I have found have helped

3条回答
  •  旧时难觅i
    2020-12-15 11:08

    Not sure what Controller method is called to show your view with documentNumberList, but you need to add that collection to the model passed to this view:

    model.addAttribute("documentNumberList", documentService.retrieveAllDocumentNumbers());
    

    Though from your exception stack trace you also missed an @Autowired on documentService field.

提交回复
热议问题