public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
String username= request.getParameter("username");
request.setAttribute("username", username);//一定要保存,OGNL才能获取${username}

 

//也可以保存在session中,但是好像视频说不好


//或者直接在jsp页面中用<%=request.getParameter("username")获取,两种结果一样,但是后者有null
request.getRequestDispatcher("/dologin.jsp").forward(request, response);

}

相关文章:

  • 2022-12-23
  • 2021-12-23
  • 2021-10-30
  • 2021-06-10
  • 2021-08-28
  • 2022-02-06
  • 2021-10-09
猜你喜欢
  • 2022-12-23
  • 2021-08-18
  • 2022-12-23
  • 2021-07-15
  • 2021-06-10
  • 2021-05-24
  • 2021-11-14
相关资源
相似解决方案