Broadleaf commerce XSRF令牌不匹配

Broadleaf commerce XSRF令牌不匹配,broadleaf-commerce,Broadleaf Commerce,嗨,我正在尝试通过管理部分的自定义控制器处理表单提交 这是我的测试控制器 @Controller @RequestMapping("/" + TempController.SECTION_KEY) public class TempController extends AdminAbstractController { protected static final String SECTION_KEY = "test2"; @RequestMapping(value = "",

嗨,我正在尝试通过管理部分的自定义控制器处理表单提交

这是我的测试控制器

@Controller
@RequestMapping("/" + TempController.SECTION_KEY)
public class TempController extends AdminAbstractController {
    protected static final String SECTION_KEY = "test2";

    @RequestMapping(value = "", method = RequestMethod.GET)
    public String test(HttpServletRequest request, HttpServletResponse response, Model model) throws Exception {
        // This is expected by the modules/emptyContainer template, this is a custom template that gets included into the body
        model.addAttribute("customView", "views/test2");
        ShippingEntity shp=new ShippingEntity();
        model.addAttribute("shipping",shp);
        // ensure navigation gets set up correctly
        setModelAttributes(model, SECTION_KEY);

        // gets the scaffolding set up to display the template from the customView attribute above
        return "modules/emptyContainer";
    }

    @RequestMapping(value = "", method = RequestMethod.POST)
    public String testPost(HttpServletRequest request, HttpServletResponse response, Model model,@ModelAttribute ShippingEntity shp) throws Exception {
        // This is expected by the modules/emptyContainer template, this is a custom template that gets included into the body
        model.addAttribute("customView", "views/test2");
        System.out.println(shp.getLink());
        System.out.println(shp.getTrackingNumber());
        model.addAttribute("shipping",shp);
        // ensure navigation gets set up correctly
        setModelAttributes(model, SECTION_KEY);

        // gets the scaffolding set up to display the template from the customView attribute above
        return "modules/emptyContainer";
    }


}   
这是视图模板:

<div class="row">
    <div class="twelve columns">
           <form action="#" th:action="@{/test2}" th:object="${shipping}" method="post">
        <p>Id: <input type="text" th:field="*{trackingNumber}" /></p>
        <p>Message: <input type="text" th:field="*{link}" /></p>
        <p><input type="submit" value="Submit" /> <input type="reset" value="Reset" /></p>
    </form>

    </div>
</div>

身份证:

信息:

问题是,当我提交值时,会出现错误:

XSRF令牌不匹配(null)。会话可能已过期

我知道这与安全问题有关,但我找不到一种方法使其工作


有什么建议可以解决这个问题吗?

显然这比我想象的要简单,也许这会对将来的人有所帮助

只需将
更改为