Reputation: 61
I just can't figure out my error. Here's my updateprofile.html.
<select class="form-control selectpicker" th:value = "${user.team}" id="team" name="team" roleId="team" required="required">
<option disabled="disabled">Select your team</option>
<option th:selected="${user.team} == 'A'}">A</option>
<option th:selected="${user.team} == 'B'}">B</option>
<option th:selected="${user.team} == 'C'}">C</option>
<option th:selected="${user.team} == 'D'}">D</option>
<option th:selected="${user.team} == 'TSO'}">TSO</option>
</select>
The error is
org.thymeleaf.exceptions.TemplateProcessingException: Could not parse as expression: "${user.team} == 'A'}" (updateprofile:54)
Here is my controller class
@RequestMapping(value = "/updateprofile", method = RequestMethod.GET)
public String updateProfile(Principal principal, Model model) {
User user = userService.findByUsername(principal.getName());
model.addAttribute("user", user);
return "updateprofile";
}
Thanks in advance for the help
Upvotes: 2
Views: 3441
Reputation: 12542
You have an extra }
in your thymeleaf expression.
Try this
<option th:selected="${user.team} == 'A'">A</option>
Upvotes: 1