I am new to Java and programming, I have just finished Java courses and now learning to use Springboot with thymeleaf and maven.
I can pass and show information with single objects but I cannot create and show the list containing these. I know this could be done with Repository but I am trying to figure this out without using it to understand the basics before moving on to repositories. I get Whitelabel error page, I know it's all wrong but I would really appreciate if someone could teach me how to do it as simple as possible. Thanks!
 public class FriendController {
     @RequestMapping(value="/hello", method=RequestMethod.GET)
     public String friendFrom (Model model) {
         model.addAttribute("friend", new Friend());
         return "/hello";
     }
     @RequestMapping(value="/hello", method=RequestMethod.POST)
     public String friendSubmit(Friend name, Model model) {
         model.addAttribute("friend", name);
         ArrayList<Friend> friends = new ArrayList<Friend>();
         friends.add(new Friend());
         return "/hello";
     }
}
<body>
    <h1>List of friends</h1>
    <table>
        <tr th:each="${friends}">
        <td th:text="${friend.name}">
        </tr>
    </table>
    <!-- This one worked on it's own -->
    <h1>ADD INFO</h1>
    <form action="#" th:action="@{/hello}" th:object="${friend}" method="post">
        <table>
        <tr>
            <td>ADD NAME: <input type="text" th:field="*{name}" /></td>
        </tr>
        </table>
        <p><input type="submit" value="Submit" /></p>
    </form>
</body>
</html>
public class Friend {
    private String name;
    public Friend() {
        super();
    }
    public Friend(String name) {
        super();
        this.name = name;
    }
    @Override
    public String toString() {
        return "Friend [name=" + name + "]";
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
}
 
     
    