doPost() processing post method
doGet handles the get method
The difference between post and get is
The security of get is not high, the password is exposed in the URL address, and the security of post is relatively higher
Get has only one stream. The parameters are appended to the URL, and the number of sizes is strictly limited and can only be strings. The parameters of the post are passed through another stream, not through the url, so it can be very large, and it can also pass binary data, such as file upload.
DoGet and doPost generally have a get and a post in the front-end method. And in the back-end Servlet method is basically the same
public class XXXXX extends HttpServlet {
public void doGet(HttpServletRequest request,HttpServletResponse esponse) throws IOException,ServletException {
request.setCaracterEncoding(“gb2312”);//汉字转码
PrintWriter out = response.getWriter();
out.println(“XXXXXX”+request.getParameter(“name”));
} }
public class XXXXX extends HttpServlet {
public void doPost(HttpServletRequest request,HttpServletResponse esponse) throws IOException,ServletException {
request.setCaracterEncoding(“gb2312”);//汉字转码
PrintWriter out = response.getWriter();
out.println(“XXXXXX”+req