私のApplicationAdvice
クラスからcurrentUserを取得し、中:Thymeleafの画像src + ParseException:例外:SpringEL式の評価: "currentUser.get( 'profilePicture')。get( 'url')"
@ModelAttribute("currentUser")
public TmtUser currentUser(Model model) {
TmtUser currentUser = TmtUser.currentUser;
model.addAttribute("currentUser", currentUser);
return currentUser;
}
currentUser
オブジェクトは、それが利用可能なurl
属性を持っています。しかし、私はページにURLをレンダリングするエラーを取得しています。おそらく、url
値が提供される前にDOMがレンダリングされるでしょうか?どうすればわかるのですか?
HTML:
<img th:src="${currentUser.get('profilePicture').get('url')}" src="" />
例外:
Caused by: org.attoparser.ParseException: Exception evaluating SpringEL expression: "currentUser.get('profilePicture').get('url')" (template: "fragments/header" - line 72, col 139)
at org.attoparser.MarkupParser.parseDocument(MarkupParser.java:393) ~[attoparser-2.0.2.RELEASE.jar:2.0.2.RELEASE]
at org.attoparser.MarkupParser.parse(MarkupParser.java:257) ~[attoparser-2.0.2.RELEASE.jar:2.0.2.RELEASE]
at org.thymeleaf.templateparser.markup.AbstractMarkupTemplateParser.parse(AbstractMarkupTemplateParser.java:230) ~[thymeleaf-3.0.3.RELEASE.jar:3.0.3.RELEASE]
... 105 common frames omitted
オブジェクトモデル:
ブラウザのコンソールエラー:構文解析ファイル自体がブラウザにロードされていないよう
[email protected] Failed to load resource: the server responded with a status of 404()
は思えます。