📄 login.jsp
字号:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
<%
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">
-->
<script language="JavaScript">
<!--
function check()
{
if(document.form1.name.value==""){
window.alert("用户名不能为空!");
document.form1.name.focus();
return false;
}
if(document.form1.pwd.value==""){
window.alert("密码不能为空!");
document.form1.pwd.focus();
return false;
}
return true;
}
//-->
</script>
</head>
<body>
<form name="form1" action="login" method="post">
<table border="1" align="center">
<tr><td>用户名</td>
<td>
<input type="text" name="name">
</td>
<tr><td>密码</td><td><input type="text" name="pwd"></td></tr>
</table>
<div align="center"><input type="submit" name="sub" value="提交" onclick="return check()">
<input type="reset" name="res" value="取消"></div>
</form>
<c:if test="${login!=null}">
<script language="JavaScript">
window.alert("请先登录!");
</script>
<c:remove var="login" scope="session"/>
</c:if>
<c:if test="${error!=null}">
<script language="JavaScript">
window.alert("登录失败!请检查你的用户名和密码!");
</script>
</c:if>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -