inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

스프링 부트 웹 개발 입문 - 따라하며 배우기

주문내역 조회기능 동작안됨 현상

해결된 질문

422

삼계해마

작성한 질문수 16

0

 

주문내역에서 고객명 조회나 물품명 조회가 안됩니다.

구글에 소스는 공유했습니다.

spring mvc spring-boot

답변 1

1

IT늦공 김부장

안녕하세요.
제가 소스를 받아서 실행해보니.. 많은 부분의 수정이 필요해 보여서
각 강의마다 해당 강좌에 해당하는 소스를 자료로 올렸습니다.
소스를 비교해가면서 체크해 보시면 강의를 따라가는데 도움이 될것 같습니다.

order.html, 컨트롤러등 해당 소스를 참고하시기 바랍니다.
한번 해보시고 막히시는 부분 올려주시면 확인하도록 할게요.

image

1

삼계해마

여전히 동작이 안되는데,, 오류도 없고...막막합니다..메뉴명으로 고객명으로 조회가 안됩니다. 소스는 공유했습니다.

1

IT늦공 김부장

안녕하세요.
올려주신 소스에는 몇가지 문제가 있는데,
첫째, order.html 은 전체적으로 완성도가 많이 빈약합니다.
아래 전체 소스를 올려 드릴게요.

둘째, OrderV2.xml 파일에 오타가 있습니다.
<select id="doSerch" -> "doSearch" a가 빠져있음.

--
order.html 파일


<!DOCTYPE html>
<html
lang="ko" xmlns:th="http://www.thymeleaf.org">
<head>
<title>Coffee Order List</title>
<meta
charset="utf-8">
<meta
name="viewport" content="width=device-width, initial-scale=1">

<link
rel="stylesheet" type="text/css" href="/css/comm.css">
<link
rel="stylesheet" type="text/css" href="/css/coffee.css">

</head>
<body>

<!-- 헤더 위치 -->
<th:block th:replace="/v2/comm/header :: headerFragment"></th:block>


<div
id="main" style="font-size:large; text-align: center; ">

<div
id="search" style="height: 150px;padding: 15px; font-size: small; width: 90%; margin-left: auto; margin-right: auto;">
<h3>
[ Coffee Order List <span style="font-size:30px;">&#128722;</span> ]</h3>

<form
name="fm_order" autocomplete="on" action="/v2/order_search" method="post">
<fieldset>
<legend>
[검색조건] </legend>
<label>
등록기간</label><input type="date" id="start_date" name="start_date" min="2020-01-01" max="2023-12-31">
- <input type="date" id="end_date" name="end_date" min="2020-01-01" max="2023-12-31">
&nbsp;&nbsp;
<label>메뉴명</label> <input type="text" id="coffee" name="coffee">
&nbsp;&nbsp;
<label>고객명</label> <input type="text" id="name" name="name">

&nbsp;&nbsp;<input type="submit" value="조회" style="width: 80px;height: 30px;font-weight: bold; font-size: medium">

<!-- <a href="javascript:loadDocArray()">test</a> -->
<!-- <label>CheckBox : </label><span id="idCheckBox"></span>-->
</fieldset>
</form>

</div>


<table
class="table">
<thead>
<tr
class="tr_td">
<th>
Chk</th>
<th>
주문번호</th>
<th>
커피No</th>
<th>
메뉴명</th>
<th>
가격</th>
<th>
고객ID</th>
<th>
고객명</th>
<th>
주문일자</th>
</tr>
</thead>


<tbody
id="t_body">
<!--- 데이타 출력 부분 -->
<tr class="tr_td" th:each="prod : ${list}">
<td><input
type="checkbox" name="chkOrderNo" th:value="${prod.getNo()}"></td>
<td
th:text="${prod.getNo()}">주문번호</td>
<td
th:text="${prod.getCoffee_no()}">커피No</td>
<td
th:text="${prod.getCoffee()}">메뉴명</td>
<td
th:text="${prod.getPrice()}">가격</td>
<td
th:text="${prod.getCust_id()}">고객ID</td>
<td
th:text="${prod.getName()}">고객명</td>
<td
th:text="${prod.getReg_day()}">주문일자</td>
</tr>

</tbody>
</table>
</div>

<!-- 푸터 위치 -->
<th:block th:replace="/v2/comm/footer :: footerFragment"></th:block>

<script>
/* 현재 시간 날짜에 적용시키기 */
const now = new Date(); // 현재 날짜 및 시간
const time7 = new Date(now.setDate(now.getDate() - 100)); // 기간 설정
document.getElementById("start_date").value= time7.toISOString().slice(0,10);
document.getElementById("end_date").value= new Date().toISOString().slice(0,10);
</script>

</body>
</html>

0

삼계해마

order.html에서 문제가 있었습니다. 감사합니다.

마이바티스 환경설정 조회하기 강의 부분에서 메뉴부분에러

0

59

2

자바 8버전이 선택지에 없는데 어떻게 하죠

0

71

2

zip파일 다운받아서 풀었는데도 계속 오류가 생기네요

0

182

2

가격 수정만 자꾸 에러페이지로 갑니다...ㅜ

0

267

2

오류가 이렇게 뜨는데

0

498

1

타임리프 > jsp

0

97

1

File imprt 어떤거 해야하죠?

0

128

1

검색기능이 안됩니다

0

142

2

검색기능이 안됩니다

0

173

3

500에러

0

168

2

v2 객체 만드는중 입니다

0

126

2

오류가 자꾸 나는데 왜이러는 걸까요?ㅠㅠ

0

239

5

오류가 왜 나는건지 모르겠어요

0

150

2

스프링 부트 버전

0

169

2

log.info가 적용이 안되는 문제

0

172

1

Spring Boot에서 jsp 연동 오류

0

317

1

7장 insert mapper erro 문의합니다

1

246

2

선생님 혹시 파일업로드도 알려주실수있나여?

2

594

1

선생님 혹시 세션하고 쿠키 부분 언제쯤 올려주실수있나여?

1

195

1

스프링 부트 2.x 버전 지원 중단, myBatis 추가가 안돼요

0

880

1

커뮤니티 버전에서 스프링 부트를 선택할수 없습니다.

1

347

1

안녕하세요 Ajax강의 잘듣고있습니다. 다름이 아니라 Ajax로 검색할떄 시작일이나 종료일 고객명과 같은 검색조건을 어떻게 구현해야하는지 고민을해보다 질문드립니다.

1

349

2

DB 생성시 발생 에러 관련! "Can't create table" "Error No 150. "Foreign key constraint is incorrectly formed")

1

527

0

int i = menuService.doInsert(coffee,kind,price); 이 코드 질문있어요

1

376

1