📄 top_index.jsp
字号:
<%@ page contentType="text/html; charset=gb2312" import="java.sql.*"%>
<html>
<head>
<title>新闻发布系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link href="css/style.css" rel="stylesheet" type="text/css">
<script language="javascript">
function login()
{
if(login_form.user.value.length == 0 || login_form.psw.value.length == 0)
{
alert("登陆用户名或密码为空");
}
else
{
login_form.submit();
}
}
function register()
{
window.open("register.jsp",width=800,height=600);
}
</script>
</head>
<body>
<%
String name = (String)session.getAttribute("username");
if(name == null || name.length() == 0)
{
%>
<table>
<form name="login_form" action="login.jsp">
<tr>
<td width="30" class="text-login" valign="right">用户:</td>
<td width="100" class="text-login"><input type=text name="user" class="inputlength120" maxlength="20"></td>
<td width="20"> </td>
<td width="30" class="text-login" valign="right">密码:</td>
<td width="100" class="text-login"><input type="password" name="psw" class="inputlength120" maxlength="20"></td>
<td width="200" ><img src="image/login.gif" onclick="login()"><img src="image/reg.gif" onclick="register()"></td>
</tr>
</form>
</table>
<%
}
else
{
String priority = (String)session.getAttribute("priority");
%>
<table>
<tr>
<td colspan="2" align="center">欢迎
<%
if("1".equals(priority))
{
out.print("普通用户");
}
if("2".equals(priority))
{
out.print("新闻员");
}
if("3".equals(priority))
{
out.print("管理员");
}
%>
<%=name%></td>
<td width="20%" align="right"><a href="logout.jsp">注销</a></td>
</tr>
</table>
<%
}
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -