HTML에서의 URL에 관한 질문
199
작성한 질문수 23
안녕하세요. 아래의 코드는 loginForm.html 인데요. 이 화면에서 ID와 비밀번호를 작성한 후 POST 방식으로 /login URL로 데이터를 전송해야 하지요.
그런데 th:onclick="|location.href='@{/}'|" 이렇게 기술되어 있는데, 어떻게 /login으로 데이터가 전송되는 것일까요?
<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8">
<link th:href="@{/css/bootstrap.min.css}"
href="../css/bootstrap.min.css" rel="stylesheet">
<style>
.container {
max-width: 560px;
}
.field-error {
border-color: #dc3545;
color: #dc3545;
}
</style>
</head>
<body>
<div class="container">
<div class="py-5 text-center">
<h2>로그인</h2>
</div>
<form action="item.html" th:action th:object="${loginForm}" method="post">
<div th:if="${#fields.hasGlobalErrors()}">
<p class="field-error" th:each="err : ${#fields.globalErrors()}" th:text="${err}">전체 오류 메시지</p>
</div>
<div>
<label for="loginId">로그인 ID</label>
<input type="text" id="loginId" th:field="*{loginId}" class="form-control"
th:errorclass="field-error">
<div class="field-error" th:errors="*{loginId}" />
</div>
<div>
<label for="password">비밀번호</label>
<input type="password" id="password" th:field="*{password}" class="form-control"
th:errorclass="field-error">
<div class="field-error" th:errors="*{password}" />
</div>
<hr class="my-4">
<div class="row">
<div class="col">
<button class="w-100 btn btn-primary btn-lg" type="submit">로그인</button>
</div>
<div class="col">
<button class="w-100 btn btn-secondary btn-lg" onclick="location.href='items.html'"
th:onclick="|location.href='@{/}'|"
type="button">취소</button>
</div>
</div>
</form>
</div> <!-- /container -->
</body>
</html>
답변 1
이미지 업로드와 db 트랜잭션 묶는법
0
68
1
Could not resolve org.springframework.boot:spring-boot-starter-validation:2.4.4
0
92
2
MessageSourceTest 코드
0
67
1
인터셉터 에러 설정
0
66
1
resolveArgument()메서드 질문
0
72
1
43강 검증1 에서 실패 로직 관련 질문있습니다.
0
81
2
타임리프 3.X 버전 rendering, serializer 에러 해결 방법
2
154
3
스프링 빈에 등록이 안되는거 같은데 어떻게 하면 좋을까요?ㅠㅠ
0
121
3
pdf 오타 문의
0
64
1
ItemUpdateForm 검증 관련 질문입니다.
0
62
1
22page 링크 주소 변경
0
70
2
특정 데이터와 파일을 함께 저장 시, 테이블 구조 질문
0
61
1
섹션3번 수업에 대한 질문입니다.
0
99
2
@Autowired 보다 더 좋은 방법이 어떤 걸까요?
0
97
2
타입컨버터 가 람다랑 비슷해 보이는데 저의 생각이 맞는지?.
0
81
1
자바스크립트 인라인에서 객체 직렬화 시 오류가 납니다
0
159
3
스프링부트 - 오류페이지2 에서 500.html 에서 쓰인 객체 질문
0
79
1
톰캣 에러 페이지가 안보입니다.
0
120
2
apiEceptionController에서 센드 에러 호출하면 안되는지?
0
91
1
세션 타임아웃시 쿠키 삭제 방법이 없나요?
0
135
2
ApiExceptionController 질문드립니다.
0
71
1
셀렉박스 챕터에서 option value에 ==배송 방식 선택== 이것을 넣은 이유가 궁금함, 이렇게 구상해도 되는지?
0
69
1
MemberRepository 필드의 fianl 선언 유무
0
92
2
혹시 index.html 에서는 fragment 사용이 안되는건가요
0
64
1





