<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script>
function checkform() {
alert("아이디 : "+document.loginForm.id.value+"\n"+
"비밀번호 : "+document.loginForm.passwd.value);
}
</script>
</head>
<body>
<form name="loginForm">
<p> 아이디 : <input type="text" name = "id"></p>
<p> 비밀번호 : <input type="password" name = "passwd"></p>
<p><input type="submit" value="전송" onclick="checkform()"></p>
</form>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script>
function checkLogin() {
var form = document.loginForm;
if(form.id.value=="") {
alert("아이디를 입력해주세요");
form.id.focus();
return false;
} else if (form.passwd.value == "") {
alert("비밀번호를 입력해주세요");
form.passwd.focus();
return false;
}
form.submit();
}
</script>
</head>
<body>
<form name="loginForm" action="validation02_process.jsp" method="post">
<p> 아이디 : <input type="text" name = "id"></p>
<p> 비밀번호 : <input type="password" name = "passwd"></p>
<p><input type="button" value="전송" onclick="checkLogin()"></p>
</form>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<h3>입력에 성공하셨습니다</h3>
<%
request.setCharacterEncoding("UTF-8");
String id = request.getParameter("id");
String passwd = request.getParameter("passwd");
%>
<p>아이디 : <%=id%></p>
<p>비밀번호 : <%=passwd %></p>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script>
function checkLogin() {
var form = document.loginForm;
if(form.id.value.length < 4 || form.id.value.length > 12) {
alert("아이디는 4 - 12자 이내로 입 력나으합니다!");
form.id.select();
return;
}
if(form.passwd.value.length < 4) {
alert("빌밀번호는 는 4자 이상으로 입 력나으합니다!");
form.passwd.select();
return;
}
form.submit()
}
</script>
</head>
<body>
<form name="loginForm" action="validation03_process.jsp" method="post">
<p> 아이디 : <input type="text" name = "id"></p>
<p> 비밀번호 : <input type="password" name = "passwd"></p>
<p><input type="button" value="전송" onclick="checkLogin()"></p>
</form>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<h3>입력에 성공하셨습니다</h3>
<%
request.setCharacterEncoding("UTF-8");
String id = request.getParameter("id");
String passwd = request.getParameter("passwd");
%>
<p>아이디 : <%=id%></p>
<p>비밀번호 : <%=passwd %></p>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script>
function checkLogin() {
var form = document.loginForm;
for(i = 0; i < form.id.value.length; i++) {
var ch = form.id.value.charAt(i);
if((ch < 'a' || ch > 'z') && (ch > 'A' || ch < 'Z') && (ch > '0' || ch < '9')) {
alert("아이디는 영문 소문자만 입력 가능합니다");
form.id.select();
return;
}
}
if (isNaN(form.passwd.value)) {
alert("비밀번호는 숫자만 입력 가능합니다!");
form.passwd.select();
return;
}
form.submit();
}
</script>
</head>
<body>
<form name="loginForm" action="validation04_process.jsp" method="post">
<p>
아이디 : <input type="text" name="id">
</p>
<p>
비밀번호 : <input type="password" name="passwd">
</p>
<p>
<input type="button" value="전송" onclick="checkLogin()">
</p>
</form>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<h3>입력에 성공하셨습니다</h3>
<%
request.setCharacterEncoding("UTF-8");
String id = request.getParameter("id");
String passwd = request.getParameter("passwd");
%>
<p>
아이디 :
<%=id%></p>
<p>비밀번호 :<%=passwd%></p>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script>
function checkMember() {
var regExpId = /^[a-z|A-Z|ㄱ-ㅎ|ㅏ-ㅣ|가-힣]/;
var regExpName = /^[가-힣]*$/;
var regExpPasswd = /^[0-9]*$/;
var regExpPhone = /^\d{3}-\d{3,4}-\d{4}$/;
var regExpEmail = /^[0-9a-zA-Z]([-_\.]?[0-9a-zA-Z])*@[0-9a-zA-Z]([-_\.]?[0-9a-zA-Z])*\.[a-zA-Z]{2,3}$/i;
var form = document.Member;
var id = form.id.value;
var name = form.name.value;
var passwd = form.passwd.value;
var phone = form.phone1.value + "-" +form.phone2.value + "-" + form.phone3.value;
var email = form.email.value;
if(!regExpId.test(id)){
alert("아이디는 문자로 시작해주세요!");
form.id.select();
return;
}
if(!regExpPasswd.test(passwd)){
alert("비밀번호는 숫자만입력해주세요!");
form.passwd.select();
return;
}
if(!regExpName.test(name)){
alert("이름은 한글만 입력해주세요");
form.name.select();
return;
}
if(!regExpPhone.test(phone)){
alert("연락처 입력을 확인해주세요");
form.phone1.select();
return;
}
if(!regExpEmail.test(email)){
alert("이메일 입력을 확인해주세요");
form.email.select();
return;
}
form.submit();
}
</script>
</head>
<body>
<form name="Member" action="validation05_process.jsp" method="post">
<p>
아이디 : <input type="text" name="id">
</p>
<p>
비밀번호 : <input type="password" name="passwd">
</p>
<p>
이름 : <input type="text" name="name">
</p>
<p>
연락처 : <select name="phone1">
<option value="010">010</option>
<option value="011">011</option>
<option value="016">016</option>
<option value="017">017</option>
<option value="019">019</option>
</select>
- <input type="text" maxlength="4" size="4" name="phone2">
- <input type="text" maxlength="4" size="4" name="phone3">
</p>
<p>
이메일 : <input type="text" name="email">
</p>
<p>
<input type="button" value="전송" onclick="checkMember()">
</p>
</form>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
request.setCharacterEncoding("UTF-8");
%>
<p>아이디 : <%=request.getParameter("id")%></p>
<p>비밀번호 : <%=request.getParameter("passwd")%></p>
<p>이름 :<%=request.getParameter("name")%></p>
<p>연락처 : <%=request.getParameter("phone1")%>-<%=request.getParameter("phone2")%>-<%=request.getParameter("phone3")%></p>
<p>이메일 : <%=request.getParameter("email")%></p>
</body>
</html>
function CheckAddProduct() {
var productId = document.getElementById("productId");
var name = document.getElementById("name");
var unitPrice = document.getElementById("unitPrice");
var unitInStock = document.getElementById("unitStock");
// 상품 아이디 체크
if(!check(/^P[0-9]{4,11}$/, productId, "[상품 코드]\nP와 숫자를 조합하여 5~12자까지 입력하세요\n첫 글자는 반드시 P로 시작하세요"))
return false;
// 상품명 체크
if(name.value.length < 4 || name.value.length>12) {
alert("[상품명]\n 최소 4자에서 최대 12자까지 입력하세요");
name.select();
name.focus();
return false;
}
// 상품 가격 체크
if(unitPrice.value.length == 0 || isNaN(unitPrice.value)) {
alert("[가격]\n숫자만 입력하세요");
unitPrice.select();
unitPrice.focus();
return false;
}
if(unitPrice.value<0) {
alert("[가격]\n음수는 입력할 수 없습니다");
unitPrice.select();
unitPrice.focus();
return false;
}else if(!check(/^\d+(?:[.]?[\d]?[\d])?$/,unitPrice, "[가격]\n소수점 둘째 자리까지만 입력하세요"))
return false;
// 재고수 체크
if(isNaN(unitInStock.value)) {
alert("[재고 수]\n 숫자만 입력하세요");
unitInStock.select();
unitInStock.focus();
return false;
}
function check(regExp, e, msg) {
if(regExp.test(e.value)){
return true;
}
alert(msg);
e.select();
e.focus();
return false;
}
document.newProduct.submit();
}
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>상품 등록</title>
<style>
.inputRow {
margin: 15px 0px;
display: flex;
align-items : center;
}
.inputRow label {
width : 150px;
}
.inputRow input, .inputRow textarea {
font-size: 1.3rem;
}
.inputRow input.btn {
font-size: 1rem;
padding : 5px 15px;
}
</style>
<script type="text/javascript" src="./resources/js/validate.js">
</script>
</head>
<body>
<jsp:include page="header.jsp" />
<div class="main">
<div class="banner">
<div class="container">
<h1>상품 등록</h1>
</div>
</div>
<div class="content">
<div class="container">
<form name="newProduct" action="./processAddProduct.jsp"
class="form-horizontal" method="post" enctype="multipart/form-data">
<div class="inputRow">
<label for="productId">상품 코드</label> <input type="text"
name="productId" id="productId">
</div>
<div class="inputRow">
<label for="name">상품 명</label> <input type="text" name="name" id ="name">
</div>
<div class="inputRow">
<label for="unitPrice">가격</label> <input type="text" name="unitPrice" id="unitPrice">
</div>
<div class="inputRow">
<label for="description">상세 정보</label>
<textarea name="description" cols="50" rows="2" id="description">
</textarea>
</div>
<div class="inputRow">
<label for="manufacturer">제조사</label> <input type="text" name="manufacturer" id="manufacturer">
</div>
<div class="inputRow">
<label for="category">분류</label> <input type="text" name="category" id="category">
</div>
<div class="inputRow">
<label for="unitStock">재고 수</label> <input type="text" name="unitInStock" id="unitStock">
</div>
<div class="inputRow">
<label>상태</label>
<label><input type="radio" name="condition" value="New"> 신규 제품</label>
<label><input type="radio" name="condition" value="Old"> 중고 제품</label>
<label><input type="radio" name="condition" value="Refurbished"> 재생 제품</label>
</div>
<div class="inputRow">
<label for="productImage">이미지</label>
<input type="file" name="productImage" id="productImage">
</div>
<div class="inputRow">
<input type="button" value="등록" class="btn btn-secondary" onclick="CheckAddProduct()">
</div>
</form>
<hr>
</div>
</div>
</div>
<jsp:include page="footer.jsp" />
</body>
</html>