inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

스프링과 JPA 기반 웹 애플리케이션 개발

관심 주제 등록 뷰

12:15와는 다른 화면이 나옵니다.

해결된 질문

341

꿀잼사슴

작성한 질문수 11

0

읽기 쉽게 fragments.html에 있는 코드를 settings.tags.html에 옮겨 적었습니다.

코드 내용

<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Study Club</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.4.1/dist/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@yaireo/tagify@3.5.1/dist/tagify.css">

    <script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.4.1/dist/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/jdenticon@3.2.0/dist/jdenticon.min.js" async
            integrity="sha384-yBhgDqxM50qJV5JPdayci8wCfooqvhFYbIKhv0hTtLvfeeyJMJCscRfFNKIxt43M" crossorigin="anonymous">
    </script>
    <style>
        .container{
            max-width: 100%;
        }
        .tagify-outside{
            border: 0;
            padding: 0;
            margin: 0;
        }
    </style>
</head>
<body class="bg-light">
    <nav class="navbar navbar-expand-sm navbar-dark bg-dark">
        <a class="navbar-brand" href="/" th:href="@{/}">
            <img src="/images/logo_symbol.png" width="30" height="30">
        </a>
        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>
    
        <div class="collapse navbar-collapse" id="navbarSupportedContent">
            <ul class="navbar-nav mr-auto">
                <li class="nav-item">
                    <form th:action="@{/search/study}" class="form-inline" method="get">
                        <input class="form-control mr-sm-2" name="keyword" type="search" placeholder="스터디 찾기" aria-label="Search" />
                    </form>
                </li>
            </ul>
    
            <ul class="navbar-nav justify-content-end">
                <li class="nav-item" sec:authorize="!isAuthenticated()">
                    <a class="nav-link" th:href="@{/login}">로그인</a>
                </li>
                <li class="nav-item" sec:authorize="!isAuthenticated()">
                    <a class="nav-link" th:href="@{/sign-up}">가입</a>
                </li>
                <li class="nav-item" sec:authorize="isAuthenticated()">
                    <a class="nav-link" th:href="@{/notifications}">
                        <i class="fa fa-bell-o"></i>
                    </a>
                </li>
                <li class="nav-item" sec:authorize="isAuthenticated()">
                    <a class="nav-link btn btn-outline-primary" th:href="@{/notifications}">
                        <i class="fa fa-plus" aria-hidden="true"></i> 스터디 개설
                    </a>
                </li>
                <li class="nav-item dropdown" sec:authorize="isAuthenticated()">
                    <a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-toggle="dropdown"
                       aria-haspopup="true" aria-expanded="false">
                        <svg th:if="${#strings.isEmpty(account?.profileImage)}" data-jdenticon-value="user127" th:data-jdenticon-value="${#authentication.name}"
                             width="24" height="24" class="rounded border bg-light"></svg>
                        <img th:if="${!#strings.isEmpty(account?.profileImage)}" th:src="${account.profileImage}"
                             width="24" height="24" class="rounded border"/>
                    </a>
                    <div class="dropdown-menu dropdown-menu-sm-right" aria-labelledby="userDropdown">
                        <h6 class="dropdown-header">
                            <span sec:authentication="name">Username</span>
                        </h6>
                        <a class="dropdown-item" th:href="@{'/profile/' + ${#authentication.name}}">프로필</a>
                        <a class="dropdown-item" >스터디</a>
                        <div class="dropdown-divider"></div>
                        <a class="dropdown-item" href="#" th:href="@{'/settings/profile'}">설정</a>
                        <form class="form-inline my-2 my-lg-0" action="#" th:action="@{/logout}" method="post">
                            <button class="dropdown-item" type="submit">로그아웃</button>
                        </form>
                    </div>
                </li>
            </ul>
        </div>
    </nav>
<div class="container">
  <div class="row mt-5 justify-content-center">
    <div class="col-2">
        <div class="list-group">
            <a class="list-group-item list-group-item-action" th:classappend="${currentMenu == 'profile'}? active" href="#" th:href="@{/settings/profile}">프로필</a>
            <a class="list-group-item list-group-item-action" th:classappend="${currentMenu == 'password'}? active" href="#" th:href="@{/settings/password}">비밀번호</a>
            <a class="list-group-item list-group-item-action" th:classappend="${currentMenu == 'notifications'}? active" href="#" th:href="@{/settings/notifications}">알림</a>
            <a class="list-group-item list-group-item-action" th:classappend="${currentMenu == 'tags'}? active" href="#" th:href="@{/settings/tags}">관심 주제</a>
            <a class="list-group-item list-group-item-action" th:classappend="${currentMenu == 'zones'}? active" href="#" th:href="@{/settings/zones}">활동 지역</a>
            <a class="list-group-item list-group-item-action list-group-item-danger" th:classappend="${currentMenu == 'account'}? active" href="#" th:href="@{/settings/account}">계정</a>
        </div>
    </div>
    <div class="col-8">
      <div class="row">
        <h2 class="col-12">관심있는 스터디 주제</h2>
      </div>
      <div class="row">
        <div class="col-12">
          <div class="alert alert-info" role="alert">
            참여하고 싶은 스터디 주제를 입력해 주세요. 스터디가 생기면 알림을 받을 수 있습니다. 태그 입력 후 콤마(,) 또는 엔터를 입력하세요.
          </div>
          <input id="tags" type="text" name="tags" class="tagify-outside" aria-describedby="tagHelp"/>
        </div>
      </div>
    </div>
  </div>
</div>
<script type="application/javascript" th:inline="javascript">
    $(function () {
        var csrfToken = /*[[${_csrf.token}]]*/ null;
        var csrfHeader = /*[[${_csrf.headerName}]]*/ null;
        $(document).ajaxSend(function (e, xhr, options){
            xhr.setRequestHeader(csrfHeader, csrfToken);
        });
    });
</script>
<script src="https://cdn.jsdelivr.net/npm/@yaireo/tagify@3.5.1/dist/tagify.min.js"></script>
    <script type="application/javascript" th:inline="javascript">
        $(function() {
            function tagRequest(url, tagTitle) {
                $.ajax({
                    dataType: "json",
                    autocomplete: {
                        enabled: true,
                        rightKey: true,
                    },
                    contentType: "application/json; charset=utf-8",
                    method: "POST",
                    url: "[(${baseUrl})]" + url,
                    data: JSON.stringify({'tagTitle': tagTitle})
                }).done(function (data, status) {
                    console.log("${data} and status is ${status}");
                });
            }

            function onAdd(e) {
                tagRequest("/add", e.detail.data.value);
            }

            function onRemove(e) {
                tagRequest("/remove", e.detail.data.value);
            }

            var tagInput = document.querySelector("#tags");
            var tagify = new Tagify(tagInput, {
                pattern: /^.{0,20}$/,
                whitelist: JSON.parse(document.querySelector("#whitelist").textContent),
                dropdown : {
                    enabled: 1, // suggest tags after a single character input
                } // map tags
            });
            tagify.on("add", onAdd);
            tagify.on("remove", onRemove);

            // add a class to Tagify's input element
            tagify.DOM.input.classList.add('form-control');
            // re-place Tagify's input element outside of the  element (tagify.DOM.scope), just before it
            tagify.DOM.scope.parentNode.insertBefore(tagify.DOM.input, tagify.DOM.scope);
        });
    </script>
</body>
</html>

결과 화면

스크린샷 2023-09-08 오후 9.33.07.png

java spring spring-boot jpa thymeleaf

답변 1

0

인프런 AI 인턴

안녕하세요, 인프런 AI 인턴이에요.

코드를 옮겨 적으셨다고 하셨는데, 지금은 다른 화면이 나오고 있는 것으로 이해하겠습니다. 현재 코드에서 어떤 문제가 발생하고 있는지 자세히 설명해주시면 도움을 드릴 수 있을 것 같아요.

화면이 나오지 않는 부분의 코드와 함께 에러 메시지나 원하는 기능에 대한 설명을 상세하게 적어주시면 빠르게 답변해드리겠습니다.

0

꿀잼사슴

image

구글 개발자 모드에서 이렇게 경고가 나옵니다.

0

꿀잼사슴

수업에서 보여준 코드대로 작성하니 뷰가 정상적으로 떴습니다.

Study 개설하는 로직에 대해서 궁금점이 있습니다.

0

55

1

앱 재시작 후 회원가입

0

103

1

app.host 관련 질문이 있습니다

0

97

1

강의 버전 정보

0

125

1

event, study 참조

0

221

2

비밀번호 변경 로직 질문있습니다.

0

135

1

프로필 수정 처리 merge 질문입니다.

0

108

1

회원가입 성공 후 redirect이동시 권한 질문

0

495

3

HtmlEmailService 개발하다 생긴 의문입니다

0

250

2

postgreSql 연결하여 JPA 를 통해 테이블 생성시 ZONE 테이블 생성에서 에러가 납니다

0

431

2

수업질문 [긴급] 로그인안되는 문제 말씀해주시는 부분 반영해서 최종 질문드립니다

0

261

2

[긴급-재업로드]수업질문 로그인 안 되는 문제

0

236

1

[긴급] 로그인해도 네비게이션 바가 안 바뀌고 있습니다!! 로그인이 안 됩니다 도와주세요

0

277

1

cropper 오류 문제로 질문드립니다..

0

288

2

authentication관련 질문...

0

496

2

모임참가 취소 할때 로직 질문

0

350

3

안녕하세요 기선님 질문이있습니다..

0

229

1

HTML코드 및 강의 중간자료들

0

679

3

springSecurity

0

524

2

버전 질문입니다.

0

302

1

부트스트랩, css

0

354

2

영속성 컨텍스트 질문

0

250

2

다시 강의를 보니 드는생각..

0

353

2

5:50에 나오는 HTML코드는 어디서 찾을 수 있나여?

0

313

1