일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
Tags
- Spring#spring#스프링#스프링프레임워크#스프링의존성주입#스프링생성자#스프링기본#국비지원#국비교육#국비지원스프링
- 국비지원JAVA#국비교육JAVA#국비지원자바#국비교육자바#JSP#SERVLET#서블릿#
- 국비지원JAVA#국비지원자바#프로그랭#JSP#국비지원JSP#국비교육JSP#웹개발자#코딩
- html#HTML#프론트엔드#개발자#코딩#국비지원#국비교육#국비지원프론트엔드#국비지원HTML#국비지원html#국비프론트엔드
- 자바
- Resource #
- Java#컴파일러#자바컴파일러#
- 개발자#it도서#도메인#DDD#ddd
- tibero#티베로#이중화#failvover
- 국비지원자바#국비교육자바#국비지원java#국비교육java#자바스크립트#프론트엔드
- Java#정처기#비트연산자#정보처리기사
- IntelliJ#인텔리제이#인텔리#단축키
- 국비지원#국비교육
- 항해99 #항해플러스 #주니어개발자 #주니어개발자역량강화 #주니어개발자멘토링 #개발자사이드프로젝트 #코딩부트캠프 #코딩부트캠프후기
- #java#JAVA#프로그래밍#웹개발자
- Java#JAVA#매개변수
- Java#java#자바#다오#디티오#브이오#dao#dto#vo
- 자바#Java#배열예시#연습#기초다지기
- db#데이터베이스#오라클#sql
- Java#java#메모리영역#클래스로더#가비지컬렉터
- #
- spring#Spring#RequestBody#ResponseBody
- 국비지원#국비교육#국비지원자바#국비교육자바#css#HTML#JAVA
- 항해플러스#항해#항해플러스3기#회고
- 국비지원JAVA
- 개발자도서#개발자책#도메인#DDD#도메인주도개발시작하기#개발스터디#
- java
- Spring#spring#스프링#스프링프레임워크#스프링자동주입#스프링생성자#스프링기본#국비지원#국비교육#국비지원스프링
- 프로그래밍
- 쿼리스트링#쿼리문자열#바인딩
Archives
- Today
- Total
개린이 개발노트
국비지원 JAVA(자바) 프로그래밍 (타임리프 이용) 본문
728x90
thymeleaf
https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-thymeleaf
//thymeleaf
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
// layout thymeleaf
implementation 'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect'
그래들에 추가 완료
<tr th:each="quesiton : ${questionList}">
-> 타임리프 문법
package com.example.sb.question;
import java.util.List;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor
@Controller
public class QuestionController {
private final QuestionRepository questionRepository;
@GetMapping("/question/list")
public String list(Model model) { //model은 자바스크립트로 따지면 이벤트같은 기능, request역할을 해줌
//질문 목록을 뽑아내는 코드
List<Question> questionList = questionRepository.findAll();
model.addAttribute("questionList", questionList);
return "question_list";
}
}
<table>
<tr>
<th>제목</th>
<th>작성일</th>
</tr>
<tr th:each="question : ${questionList}">
<td th:text="${question.subject}"></td>
<td th:text="${question.createDate}"></td>
</tr>
</table>
질문에 해당하는 답변을 등록
Answer 테이블에 레코드를 추가
id : 레코드를 식별하는 필드 (답변코드 같은개념)
content : 답변에 해당하는 내용
createDate : 답변 작성일
quesiton : 질문 객체(질문에 해당하는 모든정보)
728x90
'국비지원(국비교육) 웹 개발자 과정' 카테고리의 다른 글
국비지원 JAVA(자바) 프로그래밍(스프링부트) (0) | 2023.02.13 |
---|---|
국비지원 JAVA(자바) 프로그래밍 (영화예매사이트 구현, DAO에 대해 메서드 구현할 때) (0) | 2023.02.11 |
국비지원 JAVA(자바) 프로그래밍 (0) | 2023.02.03 |
국비지원 JAVA(자바) 프로그래밍 (데이터베이스 커넥션 풀, VO,DTO) (0) | 2023.02.03 |
국비지원 JAVA(자바) 프로그래밍 (JSP,Bundle,WebServer,WAS,서블릿,필터,JDBC) (0) | 2023.01.27 |