jpablog : 요청 주소 변경

This commit is contained in:
kim
2021-01-30 16:42:55 +09:00
parent fe6b1a679e
commit 5b5b32fc5a
6 changed files with 13 additions and 14 deletions

View File

@@ -5,7 +5,6 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@Controller @Controller
@RequestMapping("/user")
public class UserController { public class UserController {
@GetMapping("/joinForm") @GetMapping("/joinForm")

View File

@@ -1,7 +1,7 @@
server: server:
port: 8080 port: 8080
servlet: servlet:
context-path: /jpablog context-path: /
encoding: encoding:
charset: UTF-8 charset: UTF-8
enabled: true enabled: true

View File

@@ -15,14 +15,14 @@ let index = {
}; };
$.ajax({ $.ajax({
type: "post", type: "post",
url: "/jpablog/api/user", url: "/api/user",
data: JSON.stringify(data), data: JSON.stringify(data),
contentType: "application/json; charset=utf-8", contentType: "application/json; charset=utf-8",
dataType: "json" dataType: "json"
}).done(function (resp){ }).done(function (resp){
console.log(resp); console.log(resp);
alert("회원가입이 완료되었습니다."); alert("회원가입이 완료되었습니다.");
location.href = "/jpablog"; location.href = "/";
}).fail(function (error){ }).fail(function (error){
alert(JSON.stringify(error)); alert(JSON.stringify(error));
}); });
@@ -34,12 +34,12 @@ let index = {
}; };
$.ajax({ $.ajax({
type: "post", type: "post",
url: "/jpablog/api/user/login", url: "/api/user/login",
data: JSON.stringify(data), data: JSON.stringify(data),
contentType: "application/json; charset=utf-8", contentType: "application/json; charset=utf-8",
dataType: "json" dataType: "json"
}).done(function (resp){ }).done(function (resp){
location.href = "/jpablog"; location.href = "/";
}).fail(function (error){ }).fail(function (error){
alert(JSON.stringify(error)); alert(JSON.stringify(error));
}); });

View File

@@ -15,7 +15,7 @@
<body> <body>
<nav class="navbar navbar-expand-md bg-dark navbar-dark"> <nav class="navbar navbar-expand-md bg-dark navbar-dark">
<a class="navbar-brand" href="${pageContext.request.contextPath}">블로그</a> <a class="navbar-brand" href="/">블로그</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar"> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
<span class="navbar-toggler-icon"></span> <span class="navbar-toggler-icon"></span>
</button> </button>
@@ -24,23 +24,23 @@
<c:when test="${empty sessionScope.principal}"> <c:when test="${empty sessionScope.principal}">
<ul class="navbar-nav"> <ul class="navbar-nav">
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="${pageContext.request.contextPath}/user/loginForm">로그인</a> <a class="nav-link" href="/loginForm">로그인</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="${pageContext.request.contextPath}/user/joinForm">회원가입</a> <a class="nav-link" href="/joinForm">회원가입</a>
</li> </li>
</ul> </ul>
</c:when> </c:when>
<c:otherwise> <c:otherwise>
<ul class="navbar-nav"> <ul class="navbar-nav">
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="${pageContext.request.contextPath}/user/writeForm">글쓰기</a> <a class="nav-link" href="/board/form">글쓰기</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="${pageContext.request.contextPath}/user/userForm">회원정보</a> <a class="nav-link" href="/user/form">회원정보</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="${pageContext.request.contextPath}/user/logout">로그아웃</a> <a class="nav-link" href="/logout">로그아웃</a>
</li> </li>
</ul> </ul>
</c:otherwise> </c:otherwise>

View File

@@ -20,5 +20,5 @@
</form> </form>
</div> </div>
<script src="${pageContext.request.contextPath}/js/user.js"></script> <script src="/js/user.js"></script>
<%@include file="../layout/footer.jsp"%> <%@include file="../layout/footer.jsp"%>

View File

@@ -21,5 +21,5 @@
</form> </form>
</div> </div>
<script src="${pageContext.request.contextPath}/js/user.js"></script> <script src="/js/user.js"></script>
<%@include file="../layout/footer.jsp"%> <%@include file="../layout/footer.jsp"%>