본문 바로가기
study/Spring

[Spring] 24. Spring (아이디찾기, 비밀번호찾기[idsearch.jsp, pwsearch.jsp, search.jsp])

by 금이패런츠 2022. 5. 12.
728x90
반응형

idsearch.jsp 

<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>
<%-- /WEB-INF/view/user/idsearch.jsp --%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>

<!DOCTYPE html><html><head><meta charset="UTF-8">
<title>아이디찾기</title>
<link rel="stylesheet" href="../css/main.css">
</head><body>
<h3>아이디찾기</h3>
<form:form  modelAttribute="user"  action="idsearch" method="post">
  <spring:hasBindErrors name="user">
    <font color="red"><c:forEach items="${errors.globalErrors}" var="error">
         <spring:message code="${error.code}" />
      </c:forEach></font></spring:hasBindErrors>
      
<table><tr><th>이메일</th><td><input type="text" name="email">
     <font color="red"><form:errors path="email" /></font></td></tr>
 <tr><th>전화번호</th><td><input type="text" name="phoneno">
 <font color="red"><form:errors path="phoneno" /></font></td></tr>
 <tr><td colspan="2"><input type="submit" value="아이디찾기"></td></tr></table>
</form:form></body></html>

pwsearch.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>
<%-- /WEB-INF/view/user/pwsearch.jsp --%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<!DOCTYPE html><html><head><meta charset="UTF-8">
<title>비밀번호찾기</title><link rel="stylesheet" href="../css/main.css">
</head><body><h3>비밀번호찾기</h3>
<form:form modelAttribute="user"  action="pwsearch" method="post">
  <spring:hasBindErrors name="user">
    <font color="red"><c:forEach items="${errors.globalErrors}" var="error">
         <spring:message code="${error.code}" />
      </c:forEach></font></spring:hasBindErrors>
  <table>
     <tr><th>아이디</th><td><input type="text" name="userid">
     <font color="red"><form:errors path="userid" /></font></td></tr>
     <tr><th>이메일</th><td><input type="text" name="email">
     <font color="red"><form:errors path="email" /></font></td></tr>
     <tr><th>전화번호</th><td><input type="text" name="phoneno">
     <font color="red"><form:errors path="phoneno" /></font></td></tr>
     <tr><td colspan="2"><input type="submit" value="비밀번호찾기"></td></tr>
  </table></form:form></body></html>

search.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%-- /WEB-INF/view/search.jsp --%>  

<!DOCTYPE html><html><head><meta charset="UTF-8">
<title>${title}찾기</title>
<link rel="stylesheet" href="../css/main.css">
<script type="text/javascript">
   function sendclose() {
	   opener.document.loginform.userid.value='${result}';
	   self.close();
   }
</script>
</head>
<body>
<table>
 	 <tr>
  		<th>${title}찾기</th>
  			<td>${result}</td>
	</tr>
 	<tr>
 		<td colspan="2">
     		<c:if test="${title=='아이디'}">
      			<input type="button" value="아이디전송" onclick="sendclose()">
      		</c:if>
     		<c:if test="${title!='아이디'}">
      			<input type="button" value="닫기" onclick="self.close()">
      		</c:if>
      	</td>
	</tr>
</table>
</body>
</html>
728x90
반응형