html用户登录模块,分普通用户和管理员的。

就做一个用户登录模块,系统判定如果是以:Administrator账号登陆则进入管理员页面。以其他账号登录则进入普通用户页面。
普通账号:admin,密码:admin
管理员密码:admin
跪求,作业。。。周三要交。。。谢谢各位大神了。。。

第1个回答  2013-12-24
管理员账号呢?
LoginInput.jsp
<%@ 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 'LoginInput.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><center>
<form action = Login.jsp>
用户名:<input type = text name = username><br/>
密码:<input type = password name = password/><br/>
<input type = Submit value = "登陆"/>
</form>
</center>
</body>
</html>

Login.jsp
<%@ 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>
<%
String username = request.getParameter("username");
String password = request.getParameter("password");

if(username.equals("adminstrator")&&password.equals("admin")){
//管理员登陆
}
else if(username.equals("admin")&&password.equals("admin")){
//普通用户登陆
}
%>
</body>
</html>追问

能把网页文件整理出来上传成附件吗。。。。万分谢谢

追答

给你留个百度网盘的下载地址

第2个回答  2013-12-24

js判断的,没有用到服务端语言

本回答被提问者采纳
第3个回答  2013-12-24
用jsp做咋样?需要链接数据库不?追问

不用那么麻烦。。。比如我现在用Admin帐号登录,系统判断是普通用户,就弹出普通用户的页面,这个页面就用一句话代替即可x:您登录的为普通用户。管理员和这个一样。系统判定。

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网