• 软件工程概论作业-测试


    1需要网站系统开发需要掌握的技术

    1>html与css网页开发基础

    2>jsp语言

    3>javaBean技术

    4>servlet技术

    5>数据库的操作技术

    2本次课堂测试的程序源代码

    1)登陆页面:login.jsp

    <%@ page language="java" contentType="text/html; charset=UTF-8"     pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> </head> <body> <form action="index.jsp" method="post"> 登录页面<br> 账号<input type="text" name="name"/><br/> 密码<input type="password" name="psd"> <input type="submit"name="submit"value="登陆" > </form> </body> </html>

    2>连接数据库及判断账号密码界面  index.jsp

    <%@ page language="java" contentType="text/html; charset=GB18030"     pageEncoding="GB18030"%> <%@ page import="java.sql.*" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=GB18030"> <title>Insert title here</title> </head> <body> <% try{ Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); String url="jdbc:sqlserver://localhost:1433; DatabaseName=Test"; String username="sa"; String password="*******";
        String user_name=request.getParameter("name");     String user_pass=request.getParameter("psd");     if(user_name==""||user_pass==""){     out.print("姓名或密码为空,请重新输入!");     }else{
    Connection conn=DriverManager.getConnection(url, username, password); if(conn!=null){     out.println("数据库连接成功!");
    Statement sm =conn.createStatement(); //创建Statement
       ResultSet rs=sm.executeQuery("select * from users where name='"+user_name+"'"+"and psd='"+user_pass+"'");   if(rs.next()){   response.sendRedirect("receive.jsp");   }else{   response.sendRedirect("error.jsp");   }
    conn.close(); }else{ out.println("数据库连接失败!"); } } }catch(ClassNotFoundException e){ e.printStackTrace(); } %> </body> </html>

    3>登陆成功界面 receive.jsp

    <%@ page language="java" contentType="text/html; charset=GB18030"     pageEncoding="GB18030"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=GB18030"> <title>Insert title here</title> </head> <body> 登陆成功 </body> </html>

    4>登陆失败界面 error.jsp

    <%@ page language="java" contentType="text/html; charset=GB18030"     pageEncoding="GB18030"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=GB18030"> <title>Insert title here</title> </head> <body> 登陆错误,重新输入 </body> </html>

    3.运行结果截图:

    1>密码为空

    2>密码错误

    3>密码正确

    4.说明课堂测试未能按时完成的原因

    因为自己还没掌握jsp语,今天老师让课上完成,完全蒙圈,课下还需要多多学习。

    5.列出你对这门课的希望和自己的目标,并具体列出你计划每周花多少时间在这门课上。

    我对这门课的希望是尽量熟悉jsp语言的编写,尽力完成老师布置的任务,至于编软件,估计没什么可能。至于计划,我打算每周抽出4~5小时学习这门课。

  • 相关阅读:
    loadrunne-- Analysis 分析器
    Fiddler抓包工具详细介绍
    在 Windows 10 x64 上安装及使用 ab 工具的流程
    Ab工具基本使用
    ab压测返回结果解析
    VMware Workstation 14 Pro永久激活密钥
    通用接口测试用例设计
    线段树の二 区间乘+区间加
    线段树の一 区间和
    C++位运算
  • 原文地址:https://www.cnblogs.com/keaidejava/p/6486627.html
Copyright © 2020-2023  润新知