Spring启动控制器+百里香页面刷新

时间:2016-07-01 19:13:57

标签: java spring-mvc spring-boot thymeleaf

我正在开发一个仪表板页面,它将解析文件并生成图表。因此,当我单击“提交”按钮时,我希望在成功发布post方法后,该页面应该重新加载或刷新。我也启用了安全性,但禁用了csrf()。

这是我的控制器,

@RequestMapping(value = "/analyze.go", method = RequestMethod.POST)
    @ResponseBody
    public String analyze(@RequestParam("logFile") MultipartFile file) { 
        //my code

        return "{}";
        //return "redirect:dashboard.html"; 
    }

这是我的命名为dashboard.html的百万美元模板,

    <form role="form" enctype="multipart/form-data" th:action="@{/analyze.go}"
                                method="post">
                                <div class="form-group">
                                    <label for="logFile">File input</label> <input type="file"
                                        name="logFile" id="logFile"/>
                                    <p class="help-block">Select only *.log or any text type of
                                        files</p>                                       
                                    <input type="submit" class="btn btn-primary" value="Submit"/>
                            </form>

目前正在重定向到http://localhost:9090/analyze.go页面。任何想法如何克服这个问题。我试着返回&#34;重定向:redirect_page&#34;但它没有用。

0 个答案:

没有答案
相关问题