//表单提交的两种方式get 和post
//get传输量小且安全性低(用户名和密码都能在URL中看到),但效率高
//Post很适合做数据量大且安全性要求高的页面
//顺便复习一下表单的标签
//这是index.jsp的页面
<%@ page language="java" import="java.util.*" contentType="text/html;charset=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>
<h1 align="center"> 问答系统</h1>
<br>
<h2> 用户登录</h2>
<form action = "dologin.jsp" name="loginForm" method="get">//关键,action表示交给哪个页面处理,method代表传输方式,这里采用的是get方法
<table>
<tr>
<td> 用户名 : </td>
<td><input name="name" type="text" maxlength="5"/></td>
</tr>
<tr>
<td> 密码 :</td>
<td> <input name="mima" type="password" maxlength="5"/></td>
</tr>
<tr>
<td colspan="2"> <input type="submit" name="submit"value="提交">
</td>
</tr>
</table>
</form>
</body>
</html>
//这是dologin的页面
<%@ page language="java" import="java.util.*" contentType="text/html;charset=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>
登陆成功
</body>
</html>
点击提交跳转另一个页面(只有登陆成功)