码迷,mamicode.com
首页 > 其他好文 > 详细

151127

时间:2015-11-27 23:22:32      阅读:136      评论:0      收藏:0      [点我收藏+]

标签:

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>登录</title>
<script type="text/javascript">
function check()
{
	var uid =document.getElementById("userid");
	if(uid.value =="")
		{
		alert("代码不能为空");
		return false;
}
	if(uform.password.value=="")
		{
		alert("密码不能为空");
		return false;
		}
	return true;
	}
</script>
</head>
<body>
<form id="uform" action ="yanzheng.jsp" method="post" onSubmit="return check();">
用户:<input id="userid" type="text" name="userid" width=30/>
密码:<input id="passeord" type="password" name="password" width=30/>
<input type="submit" value="登录" />
<a href ="zhuce.jsp">注册新用户</a>
</form>


</body>
</html>

  

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
String strUserid =request.getParameter("userid");
String strUsername =request.getParameter("username");
String strPW =request.getParameter("password");
if(strUserid == null || strUserid.trim().length() == 0)
{
	response.sendRedirect("message.jsp?msgid=1");
}
else if(strUsername == null || strUsername.trim().length() == 0)
{
	response.sendRedirect("message.jsp?msgid=5");
}else if(strPW == null || strPW.trim().length() == 0)
{
	response.sendRedirect("message.jsp?msgid=2");
}
else
{
	Object obj=application.getAttribute(strUserid);
    if(obj!=null){
    	response.sendRedirect("message.jsp?msgid=7");
    }
    else{
	strUsername=new String(strUsername.getBytes("ISO-8859-1"),"UTF-8");
	String strUser=strUserid+"#"+strUsername+"#"+strPW;
    application.setAttribute(strUserid,strUser);
    response.sendRedirect("message.jsp?msgid=6");
    }
}
%>
</body>
</html>

  

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript">

</script>
</head>
<body>
<form action="saveUser.jsp">
用户代码:<input type="text" name="userid" width=30/><br><br>
用户名称:<input type="text" name="username" width=30/><br><br>
登录密码<input type="password" name="password" width=30/><br><br>
确认密码:<input type="password" name="queren" width=30/><br><br>
<input type="submit" value="提交"/>
</body>
</html>

  

151127

标签:

原文地址:http://www.cnblogs.com/zhuxiaolin/p/5001808.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!