본문 바로가기
개발일기

학원 수업 50일차 221101

by hhana 2023. 1. 4.
  • 9-10

레이아웃 역할 th:fragment

${} : value
~{} : fragment

(/springWebSample/src/main/resources/templates/index.html)

<html th:replace="layout/user-layout :: layout(~{this::head}, ~{this::main})">

1. index.html에 있는 head와 main을 layout이라는 이름으로 layout/user-layout.html으로 보냅니다
  (this는 생략가능)

(/springWebSample/src/main/resources/templates/layout/user-layout.html)

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
th:fragment="layout(addHead, addMain)">
    <head>
        <meta charset="UTF-8">
        <title>쿵짝쿵짝</title>
        <!-- 공통적용할 css, js를 삽입하세요 -->
        <th:block th:replace="${addHead}">추가되는 head태그 내용</th:block>
    </head>
    <body>
        <th:block th:insert="~{layout/header::header}">header태그로 삽입됩니다.</th:block>
        <th:block th:replace="${addMain}">메인태그로 대체됩니다.</th:block>
        <th:block th:insert="~{layout/footer::footer}">footer태그가 삽입됩니다.</th:block>
    </body>
</html>

2. user-layout.html에서 페이지를 완성한 후 다시 index.html로 보내 파일을 완성시킵니다

 

 

  • 10-11.5

JSP를 쓴다고 하면 어떻게 해야할까? 타임리프와 비교?
프로젝트 명 : springWebJSP
JSP란 JavaServer Pages 의 약자로
HTML 코드에 JAVA 코드를 넣어 동적웹페이지를 생성하는 웹어플리케이션 도구


https://mvnrepository.com/
https://mvnrepository.com/artifact/javax.servlet/jstl/1.2
Gradle(short) 복사 > (build.gradle) dependencies에 복붙 > 프로젝트 우클릭>Gradle > Refresh
jstl 사용방법..?
https://velog.io/@psj0810/JSTL%EC%9D%B4%EB%9E%80-JSTL-%EA%B8%B0%EC%B4%88%EC%82%AC%EC%9A%A9%EB%B2%95
https://daesuni.github.io/jstl/

jasper 검색!
https://mvnrepository.com/artifact/org.apache.tomcat.embed/tomcat-embed-jasper/10.1.1
Gradle(short) 복사 > (build.gradle) dependencies에 복붙 > 프로젝트 우클릭>Gradle > Refresh
JSP를 서블릿으로 변환시켜주는 Jasper
https://thisisnew-storage.tistory.com/6

전자정부프레임워크나 예전 기업은 타임리프 말고 jsp 쓰는 경우 있을 수 있으니 이정도로 알아둬

부트? 레거시?
Spring Legacy ? Spring Boot
https://velog.io/@rain46688/Spring-Legacy-Spring-Boot

 

 

  • 11-12

AWS !
클라우드 서비스?
아이아스 파스 사스
https://www.whatap.io/ko/blog/9/

 

 

  • 12-1

DB건드리지 않는 기본 세팅
Spring Boot DevTools
Lombok
Spring Configuration Processor
Thymeleaf
Spring Web



시큐어코딩
https://codelib.tistory.com/18

프로젝트 명 : springSecurityWeb

New Spring Starter Project Dependencies
> Security > Spring Security
https://docs.spring.io/spring-boot/docs/2.7.5/reference/htmlsingle/#web.security

http://localhost:8080/
접속하면? id 비번 입력하게 나옴
콘솔에서 Using generated security password: 비밀번호 복사 해서 넣기!
ID는 user
https://spring.io/guides/gs/securing-web/

https://spring.io/projects/spring-security#learn
https://docs.spring.io/spring-security/reference/servlet/configuration/java.html
https://docs.spring.io/spring-security/reference/servlet/configuration/java.html#jc-httpsecurity

(/springSecurityWeb/src/main/java/com/green/nowon/config/WebSecurityConfig.java)

@EnableWebSecurity
public class WebSecurityConfig {

	@Bean
	public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
		http
			.authorizeRequests(authorize ->
			authorize
				//.antMatchers("/").permitAll()
				.anyRequest().authenticated() //모든 요청에 대해 인증이 필요해요
			)
			.formLogin();
		return http.build();
	}
}

 

 

  • 2-3

AWS
rds
ec2
s3

 

 

  • 3-4

https://docs.spring.io/spring-security/reference/servlet/getting-started.html

session fixation? https://mystria.github.io/archivers/fail-case-sessioin-fixation

Charset과 Collation에 대한 개념
https://sshkim.tistory.com/128

아스키코드 0(48) A(65) 정도는 알아놔

프로젝트 명 : springWebRDS

heidisql 하이디SQL
https://www.heidisql.com/download.php

 

 

  • 4-5

(AWS 자격증)
https://goddaehee.tistory.com/194

 

 

  • 5-6

(/springWebRDS/src/main/resources/application.properties)

spring.datasource.url=jdbc:mariadb://mariadb-1.cdydrt1emvfh.ap-northeast-2.rds.amazonaws.com:3306/hana
spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
spring.datasource.username=nowon
spring.datasource.password=비번

spring.jpa.generate-ddl=true
spring.jpa.show-sql=true



(/springWebRDS/src/main/java/com/green/nowon/domain/entity/Test.java)

하이디SQL

JPA 쓸거야
AWS
MariaDB

RDS https://aws.amazon.com/ko/rds/

'개발일기' 카테고리의 다른 글

학원 수업 54일차 221107  (0) 2023.04.27
학원 수업 53일차 221104  (0) 2023.04.27
학원 수업 52일차 221103  (0) 2023.04.27
학원 수업 51일차 221102  (0) 2023.01.10
학원 수업 49일차 221031  (0) 2022.12.13
학원 수업 48일차 221028  (0) 2022.12.12
학원 수업 47일차 221027  (0) 2022.12.09
학원 수업 46일차 221026  (0) 2022.12.07

댓글