An error happened during template parsing (template: "class path resource [templates/stu/stu.html]")

created at 08-09-2021 views: 1

description

An error happened during template parsing (template: "class path resource [templates/stu/stu.html]")
Error 500, the error appears in the html page

error information

Reason

The session attribute is used in the front end, but the attribute set becomes null due to the expiration of the session, and the value cannot be obtained, and the page reports an error.

Solution

ternary operation for judgment to prevent the null value caused by session expiration from being unable to run

Operator: <text th:text="${session.S }==null?'null':${session.S.sname}"/>, 
role: <text th:text="${session.S }==null?'null':${session.S.role.rname}"/>&nbsp;&nbsp;&nbsp;
Please log in to leave a comment.