自己的网站如何给别人做有偿广告,企业网站搜索引擎推广方法包括,做资源网站,wordpress文章页尾添加信息接下来通过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输出到请求页面中完成了普通字符串的数据回写。