I want to edit a row of a table in another html page. I have a beginner with thymeleaf and Spring MVC...
profilesAll.html
but, i have this error : org.thymeleaf.exceptions.TemplateProcessingException: Error during execution of processor 'org.thymeleaf.spring5.processor.SpringInputRadioFieldTagProcessor' (template: "profilsAll" - line 39, col 26) ....
Caused by: java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'profil' available as request attribute
ProfilsAll.html :
<form th:action="@{/profiles/update}" th:object="${profil}" method="POST">
<table border="1">
<thead>
<tr>
<th>Select</th>
<th>UID</th>
<th>SIP</th>
<th>enterpriseVoiceEnabled</th>
<th>voicePolicy</th>
<th>dialPlan</th>
<th>samAccountName</th>
<th>exUmEnabled</th>
<th>exchUser</th>
<th>objectClass</th>
<th>statusProfile</th>
</tr>
</thead>
<tbody>
<tr th:if="${skypeProfiles.empty}">
<td colspan="2"> No skype profile available </td>
<tr th:each="skypeProfile, profile:${skypeProfiles}">
<td>
<input type="radio" th:field="*{profile}" th:value="${profile}" />
</td>
<td th:text=${skypeProfile.collaboraterId}>UID</td>
<td th:text=${skypeProfile.SIP}>SIP</td>
<td th:text=${skypeProfile.enterpriseVoiceEnabled}>enterpriseVoiceEnabled</td>
<td th:text=${skypeProfile.voicePolicy}>voicePolicy</td>
<td th:text=${skypeProfile.dialPlan}>dialPlan</td>
<td th:text=${skypeProfile.samAccountName}>samAccountName</td>
<td th:text=${skypeProfile.exUmEnabled}>exUmEnabled</td>
<td th:text=${skypeProfile.exchUser}>exchUser</td>
<td th:text=${skypeProfile.objectClass}>objectClass</td>
<td th:text=${skypeProfile.statusProfile}>statusProfile</td>
</tr>
</tbody>
</table>
<button type="submit" value ="Edit">Edit</button>
</form>
Controller :
@PostMapping("profiles/update")
public String profilesUpdate(@ModelAttribute("profil") SkypeProfileSearchBean skypeProfile) {
System.out.print("skypeProfile id "+skypeProfile.getCollaboraterId());
return "profilsUpdate";
}
This code is problematic but I did not find the solution :
<input type="radio" th:field="*{profile}" th:value="${profile}" />
Thank you very much for your help