1. 程式人生 > >《軟件工程綜合實踐》學習內容2

《軟件工程綜合實踐》學習內容2

rds username 學習 esc server cal href ansi input

軟件工程綜合實踐又過去了三天,學習了MVC、servelt(前後臺交互)等相關內容,每天學習的內容都在更進一步,復雜難懂的東西也越來越多。好在老師十分耐心,在比較復雜難度的地方總會添加註釋方便我們理解代碼,還會向我們推薦一些網站學習。

在第四天,我們繼續對代碼進行拓展補充,使網頁的功能更加完善,網頁頁面也初見端倪,可以進行簡單的登錄操作。

具體的主要代碼如下:

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP ‘login.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">
-->

</head>

<body>
<form action="LoginAction"method="get" >
用戶名:<input type="text" name="username" id="username"
placeholder="請輸入賬號" required="required"/>
<font color="red">${unameErr }</font>
<br/>
密碼:<input type="password" name="pwd" id="pwd"
placeholder="請輸入密碼" required="required"/>
<font color="red">${pwdErr }</font>
<br/>
<input type="submit" value="登錄"/>
</form>
</body>
</html>

第五天,我們又增加了新的功能。這一次,除了能在網頁進行登錄操作之外,我們還可以瀏覽“用戶列表”,在這個列表當中,我們可以看到每個用戶對應的用戶編號、用戶名字、用戶密碼。

具體的主要代碼如下:

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP ‘index.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">
-->
</head>

<body>
<a href="login.jsp">登陸</a><br/>
<a href="http://localhost:8080/jspservlet_1/ListAllAction">
用戶列表</a>
</body>
</html>

第六天,對前兩天的代碼進行了整理總結,並繼續進行必要的補充拓展,使得功能更加完善,網頁頁面也更加趨於完整。這三天學到的東西好多都是以前未曾學習過的,所以理解起來也更加困難。學習過程中會發現有些東西一開始一知半解但後面總能恍然大悟,這就是學習的樂趣吧。

《軟件工程綜合實踐》學習內容2