본문 바로가기

2023.11.21-2024.05.31

240102 HTML update.jsp

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
31
32
33
34
35
36
37
38
39
40
41
42
<%@page import="java.util.Map"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>글쓰기</title>
<link rel="stylesheet" type="text/css" href="./css/write.css">
<script type="text/javascript">
    function check(){
        var title = document.getElementById("title");
        if(title.value.length < 5){
            alert("제목은 5글자 이상이어야 합니다.");
            title.focus();
            return false;
        }
        var content = document.getElementsByClassName("content");
        if(content[0].value.length < 3){
            alert("내용은 3글자 이상으로 적어주세요.");
            content[0].focus();
            return false;
        }
        
    }
</script>
</head>
<body>
    <%
    Map<String, Object> detail = (Map<String, Object>) request.getAttribute("detail");
    %>
    <h1>글 수정</h1>
 
    <form action="./update" method="post">
        <input type="text" name="title" id = "title" value="<%=detail.get("board_title")%>">
        <textarea name="content" class="content"><%=detail.get("board_content") %></textarea>
        <button type="submit" onclick="return check()">글쓰기</button>
        <input type= "text" name= "no" value= "<%=detail.get("board_no")%>">
    </form>//<!--form에 묶여있으면 form과 함께한다-->
 
</body>
</html>
cs

'2023.11.21-2024.05.31' 카테고리의 다른 글

240102 HTML writeAction.jsp  (0) 2024.01.03
240102 HTML write.jsp  (0) 2024.01.03
240102 HTML detail.jsp  (1) 2024.01.03
240102 HTML delete.jsp  (1) 2024.01.03
240102 HTML index.jsp  (0) 2024.01.03