软件工程概论网站系统开发基础及目标概述

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

至少熟悉一种建站程序。

对空间和域名的知识有一定的了解。

有一些美工基础。

对编程有一些了解。

代码知识基本的要懂。

css+div会一点。

简单的网站优化技术。

熟悉引擎规则。

(2)源程序代码

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>My JSP 'success.jsp' starting page</title>

    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
<style type="text/css">
body {
    background-image: url(image/background2.jpg);
    
}

.ziti {
    font-size: 50px;
    font-style: oblique;
    color: #000;
}
</style>
  </head>
  
  <body class="ziti">
  <%
//判断application对象中有没有保存名为count的参数
//如果没有,在application对象中新增一个名为count的参数
if(application.getAttribute("count")==null){
application.setAttribute("count", new Integer(0));
}
Integer count = (Integer)application.getAttribute("count");
//使用application对象读取count参数的值,再在原值基础上累加1
application.setAttribute("count",new Integer(count.intValue()+1));
%>
  <center>
 登录成功! <br>
 <h5>
<!-- 输出累加后的count参数对应的值 -->
欢迎您访问,本页面已经被访问过 <font color="#ff0000"><%=application.getAttribute("count") %></font>次。。。。
</h5>
 </center>
  </body>
</html>
·<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>登录页面</title>
<style type="text/css">
body {
    background-image: url(image/background.jpg);
}
</style>
<script src="Scripts/swfobject_modified.js" type="text/javascript"></script>
<script type="text/javascript">
window.onload=function()
{
var bt=document.getElementById("bt");
bt.onclick=function()
{
if(document.myform.username.value=="")
{
alert("用户名不能为空!");
document.myform.username.focus();
return false;
} 
else if(document.myform.password.value=="")
{
alert("密码不能为空!");
document.myform.password.focus();
return false; 
}
}
}
</script>

<style type="text/css">
body {
    background-image: image/background.jpg;
    background-repeat: no-repeat;
    background-color: #CFF;
}
#apDiv1 {
    position: absolute;
    width: 570px;
    height: 236px;
    z-index: 1;
    left: 277px;
    top: 191px;
}
#apDiv2 {
    position: absolute;
    width: 284px;
    height: 248px;
    z-index: 1;
    left: 778px;
    top: 9px;
}
</style>
</head>

<body>
<center>
  <h1 style="color:#0F0">登录</h1>
<form action="judge.jsp" method="post" name="myform">
<ul>
<li>用户名:<input type="text" name="username" id="name" /></li>
<li>密码:<input type="text" name="password" id="age" /></li>
<li><input type="submit" value="登录" id="bt"/></li>
</ul>
</form>
<object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="300" height="600">
  <param name="movie" value="flash5126.swf" />
  <param name="quality" value="high" />
  <param name="wmode" value="opaque" />
  <param name="swfversion" value="8.0.35.0" />
  <!-- 此 param 标签提示使用 Flash Player 6.0 r65 和更高版本的用户下载最新版本的 Flash Player。如果您不想让用户看到该提示,请将其删除。 -->
  <param name="expressinstall" value="Scripts/expressInstall.swf" />
  <!-- 下一个对象标签用于非 IE 浏览器。所以使用 IECC 将其从 IE 隐藏。 -->
  <!--[if !IE]>-->
  <object type="application/x-shockwave-flash" data="image/flash5126.swf" width="300" height="600">
    <!--<![endif]-->
    <param name="quality" value="high" />
    <param name="wmode" value="opaque" />
    <param name="swfversion" value="8.0.35.0" />
    <param name="expressinstall" value="Scripts/expressInstall.swf" />
    <!-- 浏览器将以下替代内容显示给使用 Flash Player 6.0 和更低版本的用户。 -->
    <div>
      <h4>此页面上的内容需要较新版本的 Adobe Flash Player。</h4>
      <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="获取 Adobe Flash Player" /></a></p>
    </div>
    <!--[if !IE]>-->
  </object>
  <!--<![endif]-->
</object>
</center>
<script type="text/javascript">
swfobject.registerObject("FlashID");
</script>
</body>
</html>
<%@ page import="java.sql.*" 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>
<jsp:useBean id="db" class= "Bean.DBBean" scope="page"/>
<%
    request.setCharacterEncoding("utf-8");
    String username=(String)request.getParameter("username");
    String password=(String)request.getParameter("password");
    String sql="select * from dbo.login where username="+"'"+username+"'";//定义一个查询语句
    ResultSet rs=db.executeQuery(sql);//运行上面的语句
    if(rs.next())
    {
        if(password.equals(rs.getObject("password"))){
            response.sendRedirect("success.jsp");
        }
        else{
            response.sendRedirect("fail.html");
        }
    }
    else 
    {
        out.print("<script language='javaScript'> alert('账号错误——else');</script>");
        response.setHeader("refresh", "0;url=login.html");
    }

    
%>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>My JSP 'success.jsp' starting page</title>

    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
<style type="text/css">
body {
    background-image: url(image/background3.jpg);
    
}

.ziti {
    font-size: 50px;
    font-style: oblique;
    color: #000;
}
</style>
</style>
  </head>
  
  <body class="ziti">
  <center>
 登录失败! <br>
 </center>
  </body>
</html>

(3)运行结果截图

(4)课堂测试未按时完成原因:仅仅能显示登录界面,无数法连接到数据库,对sql语句不熟悉。

(5)对软件工程概论的目标:到这门课结课前能够独立完成动态web页面,并且能够成功连接数据库。计划每周除去上课最少投入十四小时在这门课上。

原文地址:https://www.cnblogs.com/duowenjia/p/7881252.html