Consistent error: Neither BindingResult nor plain target object for bean name 'flow' available as request attribute

Viewed 17

I'm using Thymeleaf and Spring Boot to try and send data to a server, but I can't even load the page because any instance of th:field results in that error.

HTML form template is here:

<form action="#" method="post" th:action="@{/flow}"  th:object="${flow}" id="myForm"> 
   <input type="text" name="mouseX" th:field="*{xpos}"id="mouseX" value="0">
   <input type="text" name="mouseY" th:field="*{ypos}" id="mouseY" value="0">
   <button type="submit">submit</button>
  </form>

Controller is here:

public class MainController {
    
   @GetMapping("flow")
  public String generateImg(Model model, BindingResult br) {
    model.addAttribute("Flow", new Flow());
    return "flow";
   }
   @PostMapping("flow")
    public String imgGen(    @ModelAttribute("flow") Flow flow, Model model, BindingResult br) {
        
           return "flow";
       }
}

I've tried a couple different things, adding and removing parameters, renaming my object, changing form action, and none seem to have any effect.

0 Answers
Related