尝试手动将Spring MVC视图呈现为html。但是不会填充模型数据

时间:2018-09-20 16:16:41

标签: java spring-mvc

这就是我要达到的目的:

View pdfView = this.viewResolver.resolveViewName("documentTesting", Locale.US);
MockHttpServletResponse mockResp = new MockHttpServletResponse();

model.addAttribute("firstName", firstName);
pdfView.render(model.asMap(), request, mockResp);

String html = mockResp.getContentAsString();
System.out.println("rendered html : " + html);

0 个答案:

没有答案