1. 程式人生 > >軟工概論第一周動手動腦

軟工概論第一周動手動腦

jsp 動手 alt public 需要 客戶 image equals title

一.需要網站系統開發需要掌握的技術

1.java語言

  1. 面向對象思想
  2. 設計模塊和框架思想
  3. xml語言
  4. 網頁腳本語言
  5. 數據庫
  6. 應用服務器
  7. 集成開發環境

二.本次課堂測試的源程序代碼

//登錄頁面

<%@ 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>

<title>登錄頁面</title>

</head>

<body>

<form name="form1" action="judge.jsp" method="get" onSubmit="check()">

<h1>用戶登錄</h1>

<table align="center" border="1" width="500">

<tr>

<td>用戶名稱 : </td>

<td>

<input type="text" name="username"

/>

</td>

</tr>

<tr>

<td>用戶密碼:</td>

<td>

<input type="password" name="password" />

</td>

</tr>

<tr align="center">

<td colspan="2">

<input type="submit" value="登錄" />

<input type="reset"

value="註冊" onclick="addInput.jsp" />

</td>

</tr>

</table>

</form>

<script type="text/javascript">

function check(){

if(form1.username.value==""){

alert("請輸入用戶名!");

form1.username.focus();

return;

}

else if(form1.password.value==""){

alert("請輸入密碼!");

form1.password.focus();

return;

}

return true;

}

</script>

</body>

</html>

//判斷頁面

<%@page import="com.jaovo.msg.Util.UserException"%>

<%@page import="com.jaovo.msg.dao.UserDaoImpl"%>

<%@page import="com.jaovo.msg.model.User"%>

<%@ 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>

<%

//接收客戶端傳遞過來的參數

String username = request.getParameter("username");

String password = request.getParameter("password");

if(username == null || "".equals(username.trim())){

request.setAttribute("error", "用戶名不能為空");

%>

<jsp:forward page="login.jsp"></jsp:forward>

<%

}

User user = new User();

user.setUsername(username);

user.setPassword(password);

UserDaoImpl userDao = new UserDaoImpl();

try{

if(userDao.load(username).getPassword()==password){

%>

<p>登陸成功!!</p><br>

<a href="#">列表</a><br>

<%

}

else{

%>

<p>登陸失敗!!</p><br>

<%

}

}catch(UserException e){

%>

<h2 style="color:red ; font-size:50px">發生錯誤 : <%=e.getMessage() %></h2>

<%

}

%>

</html>

三.運行結果截圖

技術分享圖片

技術分享圖片

技術分享圖片

技術分享圖片

四.說明課堂測試未按時完成的原因

難度太大,時間全部用在查資料中,雖然在查資料的過程中掌握了很多知識,但還是不能完整的做出來,只能借鑒同學做好的成品

感覺到自己還有很多有不足的地方,所以我想每天都至少用一個半小時的時間用來編程序,查相關資資料,增強自己的的專業技能

軟工概論第一周動手動腦