Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- jsp
- 정보처리기사
- 리눅스
- jsp연결
- VLAN
- 라우터
- 자바
- php
- w3school
- Oracle
- 네트워크관리사
- javaee
- sql
- 데이터베이스
- 원형그래프
- 오라클
- 네트워크
- cisco packet
- 참조타입
- NCS
- html
- autoset
- Cisco
- Java
- 정처기필기
- ciscopacket
- 버추얼머신
- 이것이 자바다
- ospf
- rinux
Archives
- Today
- Total
기록해! 정리해!
Tymeleaf 구조알기 본문
프로젝트 구조알기
test3를 redirect 사용해서 test4로 불러오기
1.Tymeleaf 프로젝트 생성


2.pom.xml 추가할 필요 없음
3. application.properties
# 주석 ( none , servlet )
spring.main.web-application-type=servlet
server.port=8001
# 오라클 컨넥션 정보
spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver
spring.datasource.url =jdbc:oracle:thin:@localhost:1521:xe
spring.datasource.username=system
spring.datasource.password=1234
#### 다중 mapper 설정하기
mybatis.mapper-locations=classpath:mapper/**/*.xml
# Thymeleaf Cache Setting
spring.thymeleaf.cache = false
4. index.html 생성

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<div align="center">
<h2> thymeleaf 시작하기 </h2>
<a href=Test1.do> Test1 </a> <br><br>
<a href=Test2.do> Test2 </a> <br><br>
<a href=Test3.do> Test3 </a>
</div>
</body>
</html>
5. Controller생성

package com.rubypaper.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class TestController {
@RequestMapping("Test1.do")
public void test1() {
System.out.println("==> test1 ");
}
@RequestMapping("Test2.do")
public String test2() {
System.out.println("==> test2 ");
return "test2.html";
}
@RequestMapping("Test3.do")
public String test3() {
System.out.println("==> test3 ");
return "redirect:Test4.do";
}
@RequestMapping("Test4.do")
public String test4() {
System.out.println("==> test4 ");
return "test3.html";
}
}
6. Test.html

<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<h2> Test1.html </h2>
</body>
</html>
7. 결과
>>
'SpringBoot' 카테고리의 다른 글
JPA 스타트 (테이블 생성 후 오라클에서 확인하기) (0) | 2022.10.17 |
---|---|
Thymeleaf - maven install (0) | 2022.10.17 |
thymeleaf - hello (연산, 문자열, 반복문,if) (0) | 2022.10.14 |
thymeleaf - getBoardList (날짜+합계) (0) | 2022.10.14 |
thymeleaf - getBoard 수정하기 + 순번 (0) | 2022.10.14 |
Comments