the array list from database is not displaying on browser but i can see it on the eclipse console

73 views Asked by At

this is my controller

@RequestMapping(value = "/users/{userId}/providers/{providerId}/check", method = RequestMethod.GET)
public String initNewDocumentForm121(@PathVariable("userId") int userId,@PathVariable("providerId") int providerId, Model model) {


    List<JdbcDocument> documents = this.clinicService.findByProviderIdAndUserId(providerId, userId);
    System.out.print("findByProviderIdAndUserId");
    System.out.print(documents);

        return "users/myproviders";
}

I can see documents array on the eclipse console but not on browser.

<select id="provider" class="form-control">
        <option th:value="0" >Select a Service Provider</option>
        <option th:each="document : ${documents}"  name="name"  th:value="${document.id}" th:text="${document.name}">[name]</option>
</select>

this is html. I cannot the see output on the browser. Please guide me.

1

There are 1 answers

0
vivekpansara On BEST ANSWER

After getting that object, you have to add that object into model like below to forward it :

model.addObject("documents", documents);