how to send data from servlet to rest api
问题 I want to send data from my servlet to a rest api . Is it how it's done : protected void doPost( HttpServletRequest request , HttpServletResponse response ) throws ServletException, IOException { String Id= "MyId"; response.setContentType("application/json"); response.getWriter().write(Id); getServletContext() .getRequestDispatcher("<PathofAPI>") .forward(request, response); } And once the data is send how to retreive it in my rest api 回答1: Alternatively you must create POJO class for you Id