Neither BindingResult nor plain target object for bean name ‘ProfileForm’ available as request attribute

需要添加一个ProfileForm类型的参数到请求映射方法中:

package masterSpringMvc.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
public class ProfileController2
{
    @RequestMapping("/profile")
    
    public String displayProfile(ProfileForm profileForm)
    {
        return "profile/profile";
    }
    
    @RequestMapping(value="/profile",method=RequestMethod.POST)
    
    public String saveProfile(ProfileForm profileForm)
    {
        System.out.println("save ok"+profileForm);
        return "redirect:/profile";
    }
}
模版

<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" >
<head>
    <meta content="text/html;charset=UTF-8"/>
    <title>hello</title>
</head>
<body>
    <h3>profile</h3>
    <form th:action="@{/profile}" method="post" th:object="${ProfileForm}">
    
    name:<input type="text" name="name" th:field="${ProfileForm.name}"/><br/>
    email:<input type="text" name="email" th:field="${ProfileForm.email}"/><br/>
    <input type="submit" />
    </form>
</body>
</html>