<HTML>

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Log in</title>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
	/* $(document).ready(function(){
	$("form").submit(function(){
		if($.trim($("#id").val()) == ""){
			alert("Insert your ID.");
			$("#id").focus();
			return false;
		}			
		if($.trim($("#passwd").val()) == ""){
			alert("Insert your password.");
			$("#passwd").focus();
			return false;
		}			
	});		
	});	  */
</script>

<script src="login.js"></script>

</head>
<body>

	<form method="post" action="login.jsp">
		<table border=1 width=350 align=center>
			<caption>Log in</caption>
			<tr>
				<th>ID</th>
				<td><input type=text size=30 autofocus="autofocus" id="id"
					name="id"></td>
			</tr>
			<tr>
				<th>Password</th>
				<td><input type=password size=30 id="passwd" name="passwd"></td>
			</tr>
			<tr>
				<td colspan=2 align=center><input type=submit value="Log in">
					<input type=reset value="Cancel"></td>
			</tr>
		</table>
	</form>

</body>
</html>

<Javascript>

$(document).ready(function(){
		$("form").submit(function(){
			if($.trim($("#id").val()) == ""){
				alert("Insert your ID.");
				$("#id").focus();
				return false;
			}			
			if($.trim($("#passwd").val()) == ""){
				alert("Insert your password.");
				$("#passwd").focus();
				return false;
			}			
		});		
});

<JSP>

<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<%
	request.setCharacterEncoding("utf-8");

String id = request.getParameter("id");
String passwd = request.getParameter("passwd");
%>

ID :
<%=id%>
<br>
Password :
<%=passwd%>
<br>

'Codes & Projects' 카테고리의 다른 글

HTML / Javascript / JSP ) Sign up Form2  (0) 2022.08.28
HTML / Javascript /JSP ) Bulletin Board  (0) 2022.08.28
Java) Finding Maximum value  (0) 2022.08.25
Java) Math.random()  (0) 2022.08.25
jQuery/ JSP) Sign up Form  (0) 2022.08.24

+ Recent posts