标签:hello 视图 exception return tty let iter bsp content
自定义视图
可以整合jfreechart、excel
@RequestMapping("/testView")
public String testView(){
System.out.println("testView");
return "helloView";
}
@Component
public class HelloView implements View{
@Override
public String getContentType() {
return "text/html";
}
@Override
public void render(Map<String, ?> model, HttpServletRequest request,
HttpServletResponse response) throws Exception {
response.getWriter().print("hello view, time: " + new Date());
}
}
<!-- 配置视图 BeanNameViewResolver 解析器: 使用视图的名字来解析视图 -->
<!-- 通过 order 属性来定义视图解析器的优先级, order 值越小优先级越高 -->
<bean class="org.springframework.web.servlet.view.BeanNameViewResolver">
<property name="order" value="100"></property>
</bean>
标签:hello 视图 exception return tty let iter bsp content
原文地址:https://www.cnblogs.com/znsongshu/p/10090187.html