绑定本地的Session图示解析:

绑定本地的Session

 代码的结构:

绑定本地的Session

代码:

SaveServlet.java

 1 package com.itheima.servlet;
 2 
 3 import java.io.IOException;
 4 import javax.servlet.ServletException;
 5 import javax.servlet.http.HttpServlet;
 6 import javax.servlet.http.HttpServletRequest;
 7 import javax.servlet.http.HttpServletResponse;
 8 
 9 import com.itheima.domain.User;
10 import com.itheima.service.UserService;
11 
12 /**
13  * Servlet implementation class SaveServlet
14  */
15 public class SaveServlet extends HttpServlet {
16     private static final long serialVersionUID = 1L;
17        
18 
19     public SaveServlet() {
20         super();
21     }
22 
23 
24     protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
25         User u1=new User();
26         u1.setName("测试一");
27         
28         User u2=new User();
29         u2.setName("测试二");
30         
31         new UserService().save(u1, u2);
32     }
33 
34 
35     protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
36             // TODO Auto-generated method stub
37             doGet(request, response);
38     }
39 
40 }
View Code

相关文章:

  • 2022-12-23
  • 2021-08-29
  • 2021-07-27
  • 2021-06-12
  • 2021-06-30
  • 2021-10-14
  • 2021-07-16
  • 2022-12-23
猜你喜欢
  • 2021-05-09
  • 2022-12-23
  • 2021-04-04
  • 2022-12-23
  • 2021-09-04
  • 2021-06-04
  • 2021-09-25
相关资源
相似解决方案