포트폴리오/SPRINGBOOT 옛날

3 - 09 : 글쓴이 표시

서버관리자 페페 2022. 10. 10. 18:57

단 하나의 맥락

: 전 수업에 추가한 author를 받아와, 질문과 답변에 글쓴이를 추가한다

 

-

 

Semiflow Bundle

: question_list에 글쓴이 항목 추가

: (부가 기능) - 중간 정렬과 공간 차지 비율

: question_detail의 질문에 글쓴이 항목 추가

: question_detail의 답변에 글쓴이 항목 추가 

 

-

 

자각

 

Question_list에서 글쓴이를 추가하기 위해

 

> question_list.html 에서

 

제목 틀인 

  • <tr class="text-center"></tr> 내부에

 

  • <th>번호</th>
  • <th style="width:50%">제목</th>
  • <th>글쓴이</th>
  • <th>작성일시</th>

내용 row인

 

  • <tr class="text-center" th:each="question, loop : ${paging}"></tr> 내부에
  • 번호는 건드리지 않고
  • 제목 element는 <td class="text-start"></td> 로 좌측정렬
  • <td></td> 사이 <span th:if="${question.author  !=  null}"  th:text="${question.author.username}"></span> 으로 글쓴이 정보를 공급받는다
  • 작성일시는 건드리지 않음 

 

-

 

 

질문 상세에 글쓴이를 추가하기 위해

> question_detail.html 에서

 

날짜 카드가 표시된 틀

  • <div class="d-flex  justify-content-end"></div> 내부
  • <div class="badge  bg-light  text-dark  p-2  text-start"> 

 

의 내부, 날짜시간 div 위에

 

  • <div class="mb-2"></div> 내부
  • <span th:if="${question.author != null}"  th:text="${question.author.username}"></span> 추가

 

답변은

 

  • <div class="mb-2"></div> 내부
  • <span th:if="${answer.author != null}"  th:text="${answer.quthor.username}"></span> 추가

 

6 slot : 머릿속에서 (재)확인

   
<tr></tr> 사이에 <td></td> 테이블 항목-엘리먼트-이 들어감  
타임리프 : @은 경로, $는 값, #은 함수  
특수한 경우는 <div>나 <td> 사이에 <span>이 들어감  
   
   
   

 

'포트폴리오 > SPRINGBOOT 옛날' 카테고리의 다른 글

03 : GetMapping과 PostMapping  (0) 2022.10.13
3-10 수정과 삭제  (0) 2022.10.10
3-08 : entity에 author 추가하기  (0) 2022.10.10
3-07 : 로그인과 로그아웃  (0) 2022.10.09
3-06 : 회원가입  (0) 2022.10.09