zoukankan      html  css  js  c++  java
  • 软件工程概论之登录界面

    1、需要网站系统开发需要掌握的技术:服务器语言(例如 ASP、ASP.NET、ColdFusion 标记语言 (CFML)、JSP 和 PHP)生成支持动态数据库的 Web 应用程序。还需要有Tomcat的支持,还要数据库软件sql server的支持。

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

    登录页面login.jsp

    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    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>User</title>
    </head>
    <body>
    <form action="index.jsp" method="post">
    User Log<br>
    username<input type="text" name="name"/><br/>
    password<input type="password" name="psd">
    <input type="submit"name="submit"value="log" >
    </form>
    </body>
    </html>

    连接数据库页面index.jsp

    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    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>
    <%
    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("name or password can't be null!");
    }else{

    Connection conn=DriverManager.getConnection(url, username, password);
    if(conn!=null){
    out.println("database success");

    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("database fail");
    }
    }
    }catch(ClassNotFoundException e){
    e.printStackTrace();
    }
    %>
    </body>
    </html>

    登录成功 receive.jsp

    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <!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=ISO-8859-1">
    <title>Insert title here</title>
    </head>
    <body>
    log success
    </body>
    </html>

    登录失败 error.jsp

    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <!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=ISO-8859-1">
    <title>Insert title here</title>
    </head>
    <body>
    log fail ,please try again
    </body>
    </html>

    3、运行结果截图

     

    4、说明课堂测试未及时完成的原因

    寒假并没有按要求学习网站开发技术,导致刚到学校的时候明显跟不上其他同学的步骤,落后了许多。

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

    1、学习网站开发的技术,能够独立开发一个网站,可以为其他同学服务。

    2、每周花10个小时左右的时间在软件工程上,学习和开发软件

    我计划每周花10小时的时间在这门课上。

  • 相关阅读:
    个人对回调函数的理解(personal understanding of callback function)
    蓄水池抽样及实现
    一些我做的软件
    poj1063 解题报告(poj 1063 analysis report)
    有关MAP、ML和EM的个人理解
    2012年总结
    asp.net中requiredfieldvalidator很纠结的问题(有关ClientScript属性)
    wcf在iis6上的部署
    GridView后台代码动态显示隐藏ItemTemplate
    aspx向silverlight传值
  • 原文地址:https://www.cnblogs.com/zhanghengstdu/p/7018263.html
Copyright © 2011-2022 走看看