软件工程概论课后作业一
1.网站系统开发需要掌握的技术
答:前台 photosh + dreamw + JavaScript。
后台 .net asp等会用一个编程语言就差不多了。
2.本次课堂测试的源程序代码
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">
<script type="text/javascript">
function isValidate(form)
{
userid = form.users.value;
password = form.password.value;
if(!isNull(userid))
{ alert("请输入用户名!"); form.users.focus(); return false; } if(!isNull(password)) { alert("请输入密码!"); form.password.focus(); return false; } return true; } function isNull(str) { if(str.length==0) return false; else return true; }</script>
<title>登录界面</title>
</head>
<body>
<div align="center"><h2>请登录</h2>
<form action="index.jsp"> <table> <tr> <td>用户:</td> <td><input type="text" name="users"></td> </tr> <tr> <td>密码:</td> <td><input type="password" name="password"></td> </tr> </table> <table> <tr> <td><input type="submit" value="登录" onclick="return isValidate(form)"></td> </tr> </table> </form></div>
</body>
</html>
index.jsp
<%@ page language="java" import="java.sql.*" 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=ISO-8859-1"><title>登录中</title>
</head>
<body>
<%
request.setCharacterEncoding("UTF-8"); String driverStr = "com.microsoft.sqlserver.jdbc.SQLServerDriver"; String connStr = "jdbc:sqlserver://localhost:1433; DatabaseName=Test"; String dbusername = "sa"; String dbpassword = "20153220"; Connection conn = null; PreparedStatement stmt = null; ResultSet rs = null; Class.forName(driverStr); conn = DriverManager.getConnection(connStr, dbusername, dbpassword); String sql = "select * from Login where [users]=? and [password]=?"; stmt = conn.prepareStatement(sql); String user=(String)request.getParameter("users"); String pass=(String)request.getParameter("password"); stmt.setString(1, user); stmt.setString(2, pass); rs = stmt.executeQuery(); if(rs.next()) response.sendRedirect("Login_succ.html"); else { out.print("<script language='javaScript'> alert('账号或密码错误');</script>"); response.setHeader("refresh", "0;url=Login.jsp"); } stmt.close(); conn.close();%>
</body>
</html>
Login_succ.html
<DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"><title>登录</title>
</head>
<body>
<div align = "center"><h2>登录成功</h2>
</div>
</body>
</html>
3.运行结果截图




4.课堂测试未按时完成的原因截图
寒假时没有预习,导致什么都不会,所以上课时不能完成课堂测试。
5.列出你对这门课的希望和自己的目标,并具体列出你计划每周花多少时间在这门课上
希望这门课能带给自己足够的知识,削到后期的知己独立完成一个有用的软件。计划每天花一小时在这门课上。
浙公网安备 33010602011771号