If the object itself is empty, an error will be reported when the attribute of the object is retrieved from the session
Solution:
original code:
< span th:text=”${session.user.username}”>& lt;/ span>
After change:
< span th:text=”${session.user?.username}”>& lt;/ span>
Why add one?You can solve
because this is a method for thymeleaf to judge whether the object is empty. Thymeleaf shows that an object uses ${username}, but if the username is null, thymeleaf will report an error
Similar Posts:
- Syntax error reported by JavaScript function: expected expression, got ‘;’
- How to Customizate the Style of Option Box by JQuery Component
- [Solved] EL1004E: Method call: Method fmtdate(java.util.Date,java.lang.String) cannot be found on org.thymele
- Tensorflow reported an error when using session module: attributeerror: module ‘tensorflow’ has no attribute ‘session’, which has been solved
- [Solved] Cannot call sendRedirect() after the response has been committed
- Solve the problem of style in cannot read property ‘style’ of null
- Solve the problem of style in cannot read property ‘style’ of null
- ORA-01940: cannot drop a user that is currently connected [How to Solve]
- [Solved] Python error: attributeerror: type object ‘STR’ has no attribute ‘_name_’ (machine learning practice treeplotter code)
- The thymeleaf engine in springboot reports an error [Solved]