List all data in html with Thymeleaf & Spring -
thymeleaf & spring emergency! how data inside html.
controller:
@getmapping("/") public string showregisterform(dentistvisitdto dentistvisitdto) { dentistvisitservice.listvisits(); return "form"; }
method listvisits:
@modelattribute("listvisits") public list<dentistvisitentity> listvisits () { return dentistvisitdao.getallvisits(); }
html:
<tr th:each="listvisit : ${listvisits}"> <td th:text="${listvisit.id}">1</td> <td><a href="#" th:text="${listvisit.dentistname}">title ...</a></td> <td th:text="${listvisit.visittime}">text ...</td> </tr>
currently doesn't show in html! stuck!
in controller, you'd need add elements model like:
@getmapping("/") public string showregisterform(dentistvisitdto dentistvisitdto, model model) { model.addattribute("listvisits", dentistvisitservice.listvisits()); return "form"; }
Comments
Post a Comment