Skip to content Skip to sidebar Skip to footer

Spring Mvc: Show Data In A Table Row?

I am trying to display data in a table row. However it is just showing the var name as output, e.g: Name | age User1| {age} I am using Spring-MVC along with Spring Boot. I have cr

Solution 1:

Try this :

<table><tr><th>Name</th><th>Age</th></tr><tr><td>User 1</td><tdth:text="${age}"> Age </td></tr></table>

If you have a list of age like this:

List<Integer> listOfAge = new ArrayList<>(Arrays.asList(23,45,45,23,54,23,43));
    model.addAttribute("listOfAge", listOfAge);

then try this:

<table><tr><th>Sr. No</th><th>Name</th><th>Age</th></tr><trth:each="age,iterationstatus :${listOfAge}"><tdth:text="${iterationstatus.count}">1</td><td>User 1</td><tdth:text="${age}"> Age </td></tr></table>

Post a Comment for "Spring Mvc: Show Data In A Table Row?"