本文主要是介绍商家后台页面密码修改问题—采用button提交数据,后端servlet一直取不到值,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
问题描述
在后台页面中,需要输入旧密码,跟两次新密码,然后提交以后,更新密码!
但是在这里遇到一个问题,点击提交以后,我的数据在后台怎么也取不到!
后台servlet代码:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {// TODO Auto-generated method stubrequest.setCharacterEncoding("UTF-8");UserService us = new UserServiceImpl();User user = new User();String password = request.getParameter("password");String new_password = request.getParameter("new_password");user = (User) request.getSession().getAttribute("user");System.out.println("password="+password+"new="+new_password+"user.getUsername()="+user.getUsername());int i=us.updateUser(user.getUsername(), password,new_password);if(i==1){System.out.println("密码更新成功!");request.getSession().setAttribute("user", user);request.getRequestDispatcher("/admin/personal/shop_info.jsp").forward(request, response);// request.getRequestDispatcher("/admin/login/home.jsp").forward(request, response);}else{System.out.println("密码更新失败!");// response.sendRedirect("/shop_Register/admin/login/register.jsp?erro
这篇关于商家后台页面密码修改问题—采用button提交数据,后端servlet一直取不到值的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!