item_jsp 이미지포함

팡태(❁´◡`❁)·2022년 3월 7일
0

java

목록 보기
22/36

----------insert.jsp-----------

<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>물품등록</title>
    <link rel="stylesheet" type="text/css"
        th:href="@{/css/bootstrap.css}" />
    <script type="text/javascript"
        th:src="@{/js/bootstrap.min.js}"></script>
</head>

<body>
    <div style="padding:20px">
        <h3>물품등록</h3>
        <hr />
        <form th:action="@{/item/insert}" method="post" enctype="multipart/form-data">
            물품명: <input type="text" name="name"/><br />
            가격: <input type="text" name="price"/><br />
            수량: <input type="text" name="quantity"/><br />
            대표이미지: <input type="file" name="image"/><br />

            <button type="submit" class="btn btn-primary">물품등록</button>
        </form>
    </div>
</body>
</html>

---------------------selectlist------------

<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>물품목록</title>
    <link rel="stylesheet" type="text/css"
        th:href="@{/css/bootstrap.css}" />
    <script type="text/javascript"
        th:src="@{/js/bootstrap.min.js}"></script>
</head>

<body>
    <div style="padding:20px">
        <h3>물품목록</h3>
        <hr />
        <a th:href="@{/item/insert}">물품등록</a>

        <form th:action="@{/item/selectlist}" method="get">
            <input type="hidden" name="page" value="1" />
            <input type="text" name="text" placeholder="검색어" />
            <input type="submit" value="검색" />
        </form>
        <hr />
        <table class="table">
            <tr>
                <th>번호</th>
                <th>물품번호</th>
                <th>물품명</th>
                <th>가격</th>
                <th>수량</th>
                <th>이미지</th>
                <th>버튼</th>
            </tr>
            <tr th:each="tmp, idx: ${list}">
                <td th:text="${idx.count}"></td>
                <td th:text="${tmp.code}"></td> 
                <td th:text="${tmp.name}"></td> 
                <td th:text="${tmp.price}"></td> 
                <td th:text="${tmp.quantity}"></td>
                <td>
                    <img th:src="@{/item/image(code=${tmp.code})}" style="width:50px;height:50px;" />
                </td> 
                <td>
                    <a th:href="@{/item/update(code=${tmp.code})}">수정</a>
                    <a th:href="@{/item/delete(code=${tmp.code})}">삭제</a>
                </td> 
            </tr>
        </table>

        <th:block th:each="i : ${#numbers.sequence(1,pages)}">
            <a th:href="@{/item/selectlist(page=${i})}" 
                th:text="${i}"></a>
        </th:block>
    </div>
</body>
</html>

---------------update.jsp--------------

<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>정보수정</title>
    <link rel="stylesheet" type="text/css"
        th:href="@{/css/bootstrap.css}" />
    <script type="text/javascript"
        th:src="@{/js/bootstrap.min.js}"></script>
</head>

<body>
    <div style="padding:20px">
        <h3>정보수정</h3>
        <hr />
        <form th:action="@{/item/update}" method="post">
            코드: <input type="text" th:value="${item.code}" name="code" readonly/><br />
            물품명: <input type="text" th:value="${item.name}" name="name"/><br />
            가격: <input type="text" th:value="${item.price}" name="price"/><br />
            수량: <input type="text" th:value="${item.quantity}" name="quantity"/><br />
            대표이미지: <img th:src="@{/item/image(code=${item.code})}" style="width:100px;" />
            <input type="file" name="image"/><br />
            <button type="submit" class="btn btn-primary" >수정</button>
            <a th:href="@{/item/selectlist}" class="btn btn-primary" >목록으로</a>
        </form>
    </div>
</body>
</html>

0개의 댓글