一起做网站可以一件代发吗,网页设计欣赏英文翻译,网页设计与制作教程第二版答案,网络营销大赛策划书接下来通过HttpServletResponse输出数据的案例#xff0c;演示普通字符串的回写#xff0c;案例具体实现步骤如下。
1、创建一个数据回写类DataController#xff0c;在DataController类中定义showDataByResponse()方法#xff0c;用于测试在Spring MVC中普通字符串的回写… 接下来通过HttpServletResponse输出数据的案例演示普通字符串的回写案例具体实现步骤如下。
1、创建一个数据回写类DataController在DataController类中定义showDataByResponse()方法用于测试在Spring MVC中普通字符串的回写。
Controller
public class DataController {RequestMapping(showDataByResponse)public void showDataByResponse(HttpServletResponse response) {try {response.getWriter().print(response);} catch (IOException e) { e.printStackTrace();}}
}2、启动chapter12项目在浏览器中访问地址http://localhost:8080/chapter12/showDataByResponse。访问后浏览器页面不跳转。访问地址后执行了showDataByResponse()方法方法执行后将普通字符串通过HttpServletResponse输出到请求页面中完成了普通字符串的数据回写。