When the expression ${(user. Name)! “} in freemaker is empty, an error is reported directly
FreeMarker is a template engine written in Java language. It generates text output based on the template and uses FreeMarker to judge whether the object is empty.
- general data is judged at the back end, and the front end only displays it regardless of logic. Freemaker displays that an object uses ${name}.
but if the name is null, freemaker will report an error. If you need to judge whether the object is empty: & lt; #if name?& gt;… & lt;/#if & gt;. You can also set the default value ${name! “”} To avoid the error that the object is empty. If the name is empty, it will be displayed with the default value (the character after “!”). The object user and name are the attributes of user. At this time, both user and name may be empty, which can be written as ${(user. Name)! “”}, indicating that user or name is null, which will be displayed as empty. OL>
Read More:
- The background object of thymeleaf is null, which solves the problem of error when the object is empty to get the property value
- When the spring MVC project is running on idea, an error is reported when the controller is a null pointer
- An error of 500 is reported when an item is assigned to a role
- An import error is reported in the python. The solution to setting. Pylintrc is invalid
- The Vue project is packaged and deployed to tomcat, and an Error 404 is reported as soon as it is refreshed
- Pikachu vulnerability is installed in the shooting range, and an error is reported when connecting to the MySQL database
- After Vue is packaged, a blank page appears, an error is reported in the resource request, and there is no error handling scheme
- When the mybatis field contains an expression, an error is reported when it is stored in the database
- When react devtools is enabled, an error is reported for the project
- [C + +] G + + compiler class template error message: template argument 1 is invalid
- The icon on the layui page is not displayed, and an error message is reported: Failed to decode downloaded font …..
- An error is reported when the laptop is turned on: image failed to verify with * access denied* press any key to continue
- Syntax error: typeerror: this.getoptions is not a function an error is reported when the. SCSS file is imported globally
- The imported package is gray and an error is reported
- An error is reported when Clickhouse is started. The error log information is: structure needs cleaning
- An error is reported when passing data pages using Ajax: Vue is not defined
- An error is reported when the less file is introduced into main.js
- Exception record. When eclipse starts, an error is reported when workspace is opened
- An error is reported when executing MVN. The diamond operator is not supported in source-1.5
- When installing pyaudio, an error is reported: failed error: portaudio. H: there is no such file or directory