建个网站多少钱,wordpress php7.0,建设银行网站下载中心,网站建设前期准备工作1、登录过程分析#xff1a;通过表单收集用户的数据#xff0c;Servlet通过request对象获得用户提交的数据#xff0c;服务器还需要从数据库中通过sql语句查询有没有表单提交的数据中的用户。有则登录成功#xff0c;否则#xff0c;登录失败。2、工程结构#xff1a;3、…1、登录过程分析通过表单收集用户的数据Servlet通过request对象获得用户提交的数据服务器还需要从数据库中通过sql语句查询有没有表单提交的数据中的用户。有则登录成功否则登录失败。2、工程结构3、主要代码分析登录 用户名密 码 (1)通过定义表单为Servlet提供数据其中的name属性的值与Servlet的request.getParameter的参数相同实现了html页面与服务器的联系。(2)action属性实现了页面的跳转即提交数据之后去执行Servletaction的属性值为工程名与Servlet名的组合。protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {Connection connull;login log null;String accountrequest.getParameter(username);//获得表单数据String passwordrequest.getParameter(password);try {conC3p0Utils.getConnection();QueryRunner qr new QueryRunner();String sql Select * from login where account? and password?;Object[] select {account,password};log qr.query(con, sql, new BeanHandler((login.class)), select);if(log!null){response.getWriter().write(nihaoaccount);}else{response.getWriter().write(wrong);}}catch (SQLException e) {throw new RuntimeException(e);}}Servlet在html页面与数据库之间在完成与html交流的同时还要与数据库中的数据打交道。标签account,登录,request,用户,表单,nbsp,password,Servlet来源 https://www.cnblogs.com/zhai1997/p/11521412.html