0

check object.field is not exist

example:

StaffDTO {
    private int staffId;
    private String email;
    private String password;
}

what I've tried (did not work)

<div th:text="${staffTest.?asdasd}">asdasd</div>
Towkir
  • 3,889
  • 2
  • 22
  • 41
Win Na
  • 1
  • How about this [link](https://stackoverflow.com/questions/21529085/thymeleaf-show-text-if-the-attribute-and-property-exists) – soorapadman Jun 17 '19 at 08:10
  • that's just a case of null checking, my case if the wrong field name of the object is written, templateParser will throw the error immediately. btw thks for share – Win Na Jun 17 '19 at 13:24

1 Answers1

0

I'm not sure what you wanna do

but if you want to get list of available properties try this on you object

Object.getOwnPropertyNames();
Syntax
  • 137
  • 1
  • 6
  • I'm handling on html file with thymeleaf and spring boot framework, bro. so I can't use what u said. hmmm – Win Na Jun 17 '19 at 06:25