js请求servlet并且传参数

jsp代码

 
     <%
     String id = "bbb";
    %>
 
   
 

servlet代码

public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
   String id=request.getParameter("id");
   String name=request.getParameter("name");
   System.out.println(id);
   System.out.println(name);
   response.sendRedirect("success.jsp");
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
this.doPost(request, response);
}


你可能感兴趣的:(web)