作业 第四 张垚
<%@ 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>
<form action="buu.jsp" method="post"><br>
账号:
<input type="text" name="zh"><br>
密码:
<input type="password" name="mm"><br>
<input type="submit" value="登录" >
</form>
</body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page contentType="text/html"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<body>
<%
String name = request.getParameter("zh");
String password = request.getParameter("mm");
if (name.equals("zs") && password.equals("123")) {
out.println("我的账号是:" + name);
out.println("我的密码是:" + password);
} else {
out.println("登录失败 请重新输入");
}
%>
</body>
</html>




浙公网安备 33010602011771号