Notice
Recent Posts
Recent Comments
Link
«   2024/06   »
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30
Tags
more
Archives
Today
Total
관리 메뉴

WON.dev

write_page 본문

JSP/GuestBook

write_page

GAWON 2023. 6. 2. 18:01
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style type="text/css">
	div{
		width: 800px;
		margin: auto;
		text-align: center;
	}
	table{
		width: 100%;
		border-collapse: collapse;
		text-align: left;
	}
	td , th{
		border: 1px solid black;
		padding: 10px;
	}
	th{
		width: 100px;
		background-color: lime;
		color: #fff;
		text-align: center;
	}
	tr:nth-of-type(7) {
		text-align: center;
}
</style>
<script type="text/javascript">
	function writeGuestbook(f){
		//작성자 , 제목 , 내용데이터 필수 입력
		//submit
		if ( f.writer.value == "" || f.title.value == "" || f.content.value == "" ) {
			alert("내용을 입력하세요.");
			return;
		}
		f.submit();
	}

</script>
</head>
<body>
   <div>
      <h2>방명록 작성</h2>
      <form action="write.jsp" method="post" enctype="multipart/form-data">
         <table>
            <tbody>
               <tr>
                  <th>작성자</th>
                  <td><input type="text" name="writer" size="80"></td>
               </tr>
               <tr>
                  <th>제목</th>
                  <td><input type="text" name="title" size="80"></td>
               </tr>
               <tr>
                  <th>이메일</th>
                  <td><input type="text" name="email" size="80"></td>
               </tr>
               <tr>
                  <th>비밀번호</th>
                  <td><input type="password" name="pw" size="80"></td>
               </tr>
               <tr>
                  <th>첨부파일</th>
                  <td><input type="file" name="filename"></td>
               </tr>
					<tr>
						<th>내용</th>
						<td><textarea rows="10" cols="80" name="content"></textarea></td>
					</tr>
					<tr>

						<td colspan="2">
						<input type="button" value="방명록 저장"
							onclick="writeGuestbook(this.form)"> 
							<input type="reset" value="다시 작성"> 
							<input type="button" value="목록으로 이동" onclick="location.href='index.jsp'">
						</td>
					</tr>
				</tbody>
         </table>
      </form>
   </div>
</body>
</html>

'JSP > GuestBook' 카테고리의 다른 글

write  (0) 2023.06.02
update  (0) 2023.06.02
update_page  (0) 2023.06.02
remove  (0) 2023.06.02
romove_page  (0) 2023.06.02