The use of th:text in thymeleaf tags
When writing <p th:text=" "></p>, I found the following writing on the Internet (it was still wrong)
If you need to get the value from the model, it is written as th:text="${model's name}"
th:text="${childD.name}"
If the string needs to be spliced with the value in the model, it is written as th:text="'string'+${model's name}"
th:text="'姓名:'+${childD.name}"
****************************************************************************************************************************************
My program is:
There are three objects in pojo: User (userId, username, password, adId)
Address(adId, province, city) //adId is a foreign key fk
extendUser(Address address) //该类继承User (public class extendUser extends User)
Let's show it with pictures~~
1. First look at the Controller
2. Call userAddressService.findAllUserAddress() according to the Controller, looking at the Service layer
3 Next is the ServiceImp layer
4. Finally, the Mapper (dao) layer
5、Mapper.xml
6. Finally, the HTML
***************************************************************************************************************
Here I am back to my initial focus: <p th:text=" "></p>
I kept making mistakes at first, but later found out that ${User.userName} doesn't work, it must be written as ${extendUser.userName}.
turn out to be:
Although extendUser inherits User, it is necessary to write the direct class extendUser in ${ }.