接口是第三方提供的,目前已经调通,
查询时需要 传递参数 与调用相关方法。
请问在 在调用接口时,如何传值与获得参数。 jsp 页面用 function x(){ var name=$("#name").val(); //查询时的参数 $.ajax({ type: 'post', url: "/servlet/ls", timeout: 300, dataType:"JSON", async:false, success: function (success) { } }); } Java 中该如何设置参数,
public void doGet(HttpServletRequest request, HttpServletResponse response,String name) throws ServletException, IOException { request.setCharacterEncoding("utf-8"); response.setContentType("text/html;charset=utf-8"); response.setCharacterEncoding("utf-8"); PrintWriter out = response.getWriter(); String ls = Service.findls("{\"name\":"+name+"}"); System.out.println(ls); out.write(ls); out.flush(); out.close(); }
慕慕森
largeQ
相关分类