Myeclipse登录样式

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/qq_45747891/article/details/102733592

Myeclipse登录样式

先看代码 吧

<%@ 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>
<script src="js/jquery.js"></script>
	</head>
	<body>
		<form action="#">
			用户名:<input type="text"  name="name" id="name"  /><br />
			 密 码:<input type="text" name="pwd" id="pwd" /><br /> 
			 <input type="button" value="登录" />
		</form>
		<div id=ip></div>
		<script>
		function verifyName() {
			//用户名校验
			var verifyName = document.getElementById("name").value;
			var name = /^[A-Z][0-9A-Za-z_][a-zA-Z0-9_]{5,19}$/; 
			if (!name.test(verifyName)) {
				$("#name").css("border-color", "blue");
				return false;
			} else {
				return true;
			}
		}
		function verifyPwd() {
			//密码
			var verifyPwd = document.getElementById("pwd").value;
			var pwd = /^[A-Z][A-Za-z0-9]\w{7,14}.{1,20}$/; 
			if (!pwd.test(verifyPwd)) {
				$("#username").css("border-color", "blue");
				return false;
			} else {
				return true;
			}
		}
		$(function() {
			$(":button").on("click", function() {
				$.ajax({
					type : "post",
					url : "servlet",
					data : {
						name : $("#name").val(),
						pwd : $("#pwd").val()
					},
					dataType : "text",
					success : function(data) {
						if (data == "ok") {
							window.location.href = "ip.jsp";
						} else {
							alert("登录失败!");
							$("#pwd").val("");
							$("#name").focus().select();
						}
					}
				});
			});
		});
	</script>
</body>
</html>

另一个页面

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'show.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>
    登录成功啦!<br>
  </body>
</html>

Myeclipse你值得拥有

猜你喜欢

转载自blog.csdn.net/qq_45747891/article/details/102733592