use session

This commit is contained in:
Kana
2024-01-18 16:15:34 +09:00
parent 8490d7936e
commit 463fda993e
4 changed files with 18 additions and 40 deletions

View File

@@ -1,4 +1,5 @@
<%@ page contentType="text/html; charset=UTF-8"%> <%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
@@ -45,11 +46,8 @@
aria-describedby="basic-addon1"> aria-describedby="basic-addon1">
</div> </div>
<!-- 추후 수정 --> <c:set var="userData" value="${sessionScope.userData}" />
<input type='hidden' id="manager_id" value="83bdda69-ae95-11ee-935d-0242ac110006"> <input type='hidden' id="manager_id" value="${userData.id }">
<!-- 추후 수정 -->
</div> </div>
</div> </div>
</div> </div>
@@ -93,8 +91,8 @@ $(document).ready(function() {
type: "post", type: "post",
data: { data: {
"price": price, "price": price,
"manager_id": manager_id, // 추후 수정해야함. "manager_id": manager_id,
"product_id": product_id, // 추후 수정해야함. "product_id": product_id,
"activation": true "activation": true
}, },
datatype:"json" datatype:"json"
@@ -102,24 +100,6 @@ $(document).ready(function() {
if (data == true) { if (data == true) {
alert("제품 가격을 추가했습니다."); alert("제품 가격을 추가했습니다.");
$(location).attr("href", "/price/list"); $(location).attr("href", "/price/list");
//생각해서 바꿔야함.
// 조건 : DB에서 생성되는 uuid를 어떻게 자바스크립트에서 가져올것인지 궁리.
/*
var form = document.createElement("form");
form.action = "/product/read";
form.method = "POST";
document.body.appendChild(form);
var input = document.createElement("input");
input.type = "hidden";
input.name = "id";
input.value = data.id;
form.appendChild(input);
form.submit();
*/
} else { } else {
alert("제품 가격 추가에 실패하였습니다."); alert("제품 가격 추가에 실패하였습니다.");
} }
@@ -153,8 +133,5 @@ function showSearchModal(title, val){
</script> </script>
</body> </body>
</html> </html>

View File

@@ -1,4 +1,5 @@
<%@ page contentType="text/html; charset=UTF-8"%> <%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
@@ -34,14 +35,15 @@
<input type="text" class="form-control" placeholder="등록날짜" <input type="text" class="form-control" placeholder="등록날짜"
aria-label="등록날짜" value="${dto.registration_date }" readonly> aria-label="등록날짜" value="${dto.registration_date }" readonly>
</div> </div>
<c:set var="userData" value="${sessionScope.userData}" />
<div class="input-group mb-3 w-40 col-centered"> <div class="input-group mb-3 w-40 col-centered">
<span class="input-group-text" id="basic-addon4">담당자</span> <span class="input-group-text" id="basic-addon4">담당자</span>
<input type="text" class="form-control" placeholder="담당자" <input type="text" class="form-control" placeholder="담당자"
aria-label="담당자" value="${dto.accountDto.name }" readonly> aria-label="담당자" value="${userData.name }" readonly>
</div> </div>
<input type='hidden' id="id" value="${dto.id }"> <input type='hidden' id="id" value="${dto.id }">
<input type='hidden' id="manager_id" value="${userData.id }">
</div> </div>
</div> </div>
</div> </div>
@@ -62,6 +64,7 @@
$("#submitBtn").on("click", function() { $("#submitBtn").on("click", function() {
var id = $("#id").val(); var id = $("#id").val();
var price = $("#price").val(); var price = $("#price").val();
var manager_id = $("#manager_id").val();
if (!price || isNaN(price)) { if (!price || isNaN(price)) {
alert("올바른 가격을 입력하세요."); alert("올바른 가격을 입력하세요.");
@@ -74,7 +77,8 @@
type: "put", type: "put",
data: { data: {
"id": id, "id": id,
"price": price "price": price,
"manager_id": manager_id
}, },
datatype: "json" datatype: "json"
}).done(function(data) { }).done(function(data) {

View File

@@ -63,11 +63,9 @@
<input type='hidden' id="vendor_id" value=""> <input type='hidden' id="vendor_id" value="">
</div> </div>
<!-- 추후 수정 --> <c:set var="userData" value="${sessionScope.userData}" />
<input type='hidden' id="manager_id" value="83bdda69-ae95-11ee-935d-0242ac110006"> <input type='hidden' id="manager_id" value="${userData.id }">
<!-- 추후 수정 -->
</div> </div>
</div> </div>
</div> </div>
@@ -81,7 +79,7 @@
</div> </div>
</div> </div>
</form> </form>
</div>
<!-- 스크립트 --> <!-- 스크립트 -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>

View File

@@ -1,4 +1,5 @@
<%@ page contentType="text/html; charset=UTF-8"%> <%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
@@ -59,10 +60,8 @@
</div> </div>
<input type='hidden' id="id" value="${dto.id }"> <input type='hidden' id="id" value="${dto.id }">
<!-- 추후 수정 --> <c:set var="userData" value="${sessionScope.userData}" />
<input type='hidden' id="manager_id" value="83bdda69-ae95-11ee-935d-0242ac110006"> <input type='hidden' id="manager_id" value="${userData.id }">
<!-- 추후 수정 -->
</div> </div>
</div> </div>