wx.request无法与后台互交问题,请教。

发布于 6 年前作者 houguiying7772 次浏览最后编辑 6 年前来自 ask

学习wx.request与后台互交,前端一直报POST(或GET)(url)not found。

wx.request与后台互交,后台代码应该怎么写,来实现取值与传值。

能否提供一个后台代码实例。

4 回复
juan91
juan911 楼6 年前

是合法域名。主要不知道后台代码是否写正确,获取不到。

qiangzheng
qiangzheng2 楼6 年前

域名添加了吗?校验了吗

gang50
gang503 楼6 年前

跟域名没有关系。主要是不知道后台java获取数据代码怎么写。

下面是我参照写的后台代码。

public class hello {

@RequestMapping (value=“/hello2”)

public void hello2(HttpServletRequest request, HttpServletResponse response)

{

   System.out.println(request.getParameter(“city”));

  

   

   

 

}

public void doGet(HttpServletRequest request, HttpServletResponse response)

  throws ServletException, IOException {

   hello2(request, response);

}

}

前台通过wx.request去调用url/hello2这个这个网页,提示not found。

但是通过websoket可以传值。

xiuyingqiao
xiuyingqiao4 楼4 年前

你的URL是否是request的合法域名?