Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html SpringBoot模型属性在post请求后不可用_Html_Spring Boot_Thymeleaf - Fatal编程技术网

Html SpringBoot模型属性在post请求后不可用

Html SpringBoot模型属性在post请求后不可用,html,spring-boot,thymeleaf,Html,Spring Boot,Thymeleaf,在通过post请求提交表单后,我尝试将一些值返回到我的webapp 控制器 @Controller public class testController { @ResponseBody @RequestMapping(value = "/testPage", method = RequestMethod.POST) public String downloadFile(Model model, HttpServletRequest request, HttpServletResponse r

在通过post请求提交表单后,我尝试将一些值返回到我的webapp

控制器

@Controller
public class testController {

@ResponseBody
@RequestMapping(value = "/testPage", method = RequestMethod.POST)
public String downloadFile(Model model, HttpServletRequest request, HttpServletResponse response, @ModelAttribute("file") File file) {
data = file.generateData; //This method returns a string
model.addAttribute("output", fileOutput);
return "testPage";
HTML 使用胸腺素

<p th:text="${output}"></p>

标记不包含预期数据,因此为空

我错过了什么


多谢各位

带有@ResponseBody的方法是返回字符串“testPage”
如果您的页面名为testPage,则删除注释@ResponseBody

删除@ResponseBody会给我以下信息:
原因:java.lang.IllegalStateException:getOutputStream()已为此响应调用
,根据我看到的代码,它不应导致此问题,据估计,您的代码编写不完整。此异常的原因是重复调用流的输出