2017-10-22 23 views
0

私のエラーを特定できません。ここに私のupdateprofile.htmlがあります。Thymeleafは式thとして解析できませんでした。選択肢

<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> 

エラーが

org.thymeleaf.exceptions.TemplateProcessingExceptionである:式として を解析できませんでした: "$ {user.team} == 'A'}"(updateprofile:54)ここで

は私のコントローラクラスで

@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"; 
} 

おかげでヘルプのために進んでください

答えて

0

あなたのthymeleafの表現に余分な}があります。

この

<option th:selected="${user.team} == 'A'">A</option>

をお試しください
関連する問題