http接口测试—服务端的编写
1、这里我们使用eclipse创建一个web工程,名称为lctest,服务器使用的是tomcat(这个不会的童鞋可以查一下资料) 2、这里的一个服务端相对简单, 输入参数:任何数据, 输出参数:"访问方式"+method+"访问成功");"输入参数param为:"+param); 3、下面我们就开始编写服务端 1)创建一个Servlet名称为testServlet 2) 在testServlet中添加excute方法,内容如下 public void excute(HttpServletRequest request,HttpServletResponse response) throws Exception{ request.setCharacterEncoding("utf-8"); response.setCharacterEncoding("UTF-8"); response.setContentType("text/xml"); String method=request.getMethod(); String url=request.getRequestURI(); String param; if(request.getParameter("param")==null){ param="输入参数为空"; }else if(method=="GET"){ param