jeudi 23 juillet 2020

Spring framework - List members on page - Thymeleaf

I want a page on my website that lists all of the users, and their details. I am using spring framework combined with thymeleaf. Here is my User class

@Entity
data class User(
        @Id
        @GeneratedValue(strategy = GenerationType.AUTO)
        val id:Long = 0,
        val joinDate: LocalDateTime,
        val userName:String,
        val firstName:String,
        val email:String,
        val password:String,
        @ManyToMany(fetch = FetchType.EAGER)
        @JoinTable(name = "users_roles", joinColumns = [JoinColumn(name = "user_id", referencedColumnName = "id")], inverseJoinColumns = [JoinColumn(name = "role_id", referencedColumnName = "id")])
        val roles:List<Role> = listOf()
)

This would need to be formatted nicely as well. I understand I can loop over the UserRepository's users, however I do not understand how I put that on my page via thymelaef. Thanks




Aucun commentaire:

Enregistrer un commentaire