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:
- How to Solve FreeMarker template error
- Eureka starts abnormally and prompts FreeMarker template error
- 13.2 spring boot start error: whitelabel error page
- [Vue warn]: Error in render: “TypeError: Cannot read properties of undefined
- MySQL modify character set
- How to deal with NullPointerException error in row.getlong in spark – sparksql
- Error: l6242e: cannot link object arm_ cos_ f32.o as its attributes are incompat
- Abnormal display of page object moved to here
- Flutter Error: Cannot run with sound null safety, because the following dependencies don‘t support
- DB2 create table error – 104 42601 illegal symbol encountered in SQL statement
- Springboot integration redis reports non null key required (solved)
- ERROR 1406 (22001): Data Too Long, field len 30, data len 48
- Android EditText cursor control, color modification, show and hide
- Error reporting: java.lang.nullpointerexception solution
- [Vue warn]: Error in nextTick: “TypeError: Cannot read property ‘map‘ of null“
- Solution of adding judgment error in the iterative process of Java iterator iterator
- The background object of thymeleaf is null, which solves the problem of error when the object is empty to get the property value
- 1067 – Invalid default value for ‘sex‘1366 – Incorrect string value: ‘\xE6\x8A\x80\xE6\x9C\xAF…‘ f
- Mybatis-plus automatically generates code error [Solved]
- ajax error 400 (Failed to load resource: the server responded with a status of 400 (Bad Request))