개발일기

학원 수업 38일차 221014

hhana 2022. 11. 18. 11:37
  • 9-10

깃에 업로드한거 주소 복사한 후 Git repository에서 클론해옴
가져오면 Remote Tracking에 브랜치있음
임포트 > Gradle > Existing gradle project > 클론해온 주소 지정 후 import finish

zip 파일은 임포트 > General > Existing Projects into Workspace

war 파일은 Web > war file


깃에 올린 레포지토리 수정한거 추가로 올리고 싶어!
Git Staging에서 파일 선택해서 commit
Git repository 탭에서 Branches > Local에서 마스터 푸쉬

Git repository 탭에서 Remotes > origin Fetch/Push 어떻게 쓰는지 질문
https://backlog.com/git-tutorial/kr/stepup/stepup3_2.html
pull 을 실행하면, 원격 저장소의 내용을 가져와 자동으로 병합 작업을 실행하게 됩니다. 그러나 단순히 원격 저장소의 내용을 확인만 하고 로컬 데이터와 병합은 하고 싶지 않은 경우에는 fetch 명령어를 사용할 수 있습니다.

https://seonkyukim.github.io/git-tutorial/git-fetch/

작업중에는 프로젝트 우클릭 > team > disconnect 해놓고 (깃이랑 연결 끊고) 작업하자
다시 연결하려면 team에서 share project로 하면됨

 

 

  • 10-11

templates패키지에는 html만 넣고
나머지는 static폴더에 넣습니다

(BoardController.java)
ViewResolver ?
https://devbox.tistory.com/entry/Spring-ViewResolver-%EC%84%A4%EC%A0%95

@GetMapping
Specifically, @GetMapping is a composed annotation that acts as a shortcut for @RequestMapping(method = RequestMethod.GET).

Run 잘못누르면 WEB-INF 폴더 생성되면서 web.xml파일이 만들어지는데 지워주면 됨

a 태그 정렬!
https://investechnews.com/2021/05/17/css%EB%A1%9C-a%ED%83%9C%EA%B7%B8-%EC%A0%95%EB%A0%AC%ED%95%98%EA%B8%B0a-tag-%EB%A7%81%ED%81%AC-%ED%83%9C%EA%B7%B8-%EC%A0%95%EB%A0%AC/
https://xodgl2.tistory.com/82
a태그는 div나 article 태그로 감싼 뒤, div나 article 태그에 text-align:center; 명령을 줘야함

이클립스에서 Homework1007를 nowon-kdt 그룹에 새로운 브랜치 생성하여 푸쉬했음

 

 

  • 11-12

스프링, html로 Board만드는 중

 

 

  • 2-3

https://www.thymeleaf.org/documentation.html
https://www.thymeleaf.org/doc/tutorials/3.0/usingthymeleaf.html

https://www.thymeleaf.org/doc/tutorials/3.0/usingthymeleaf.html#link-urls
Let’s use this new syntax. Meet the th:href attribute:

https://www.thymeleaf.org/doc/tutorials/3.0/usingthymeleaf.html#standard-expression-syntax
Text operations:
String concatenation: +
Literal substitutions: |The name is ${name}|

Model (request.setAttribute와 동일한 기능. 데이터 전송 담당)

 

 

  • 3-4

xmlns:th //(xmlnamespace)
https://www.thymeleaf.org/doc/tutorials/3.0/usingthymeleaf.html#using-texts
<html xmlns:th="http://www.thymeleaf.org">

삭제기능 구현
BoardController.java
@DeleteMapping

 

 

  • 4-5

(BoardController.java)
//HiddenHttpMethodFilter 적용 : 
//1. (application.properties) spring.mvc.hiddenmethod.filter.enabled=true
//2. method="post"
//3. <input type="hidden" name="_method" value="DELETE">
//(히든 메서드 파라미터)필터를 사용해서 method를 post에서 Delete로 변환해야함
//삭제시 DeleteMapping 사용하자


(HiddenHttpMethodFilter) 클래스 확인해보니
public class HiddenHttpMethodFilter implements WebFilter {

private static final List<HttpMethod> ALLOWED_METHODS =
Collections.unmodifiableList(Arrays.asList(HttpMethod.PUT,
HttpMethod.DELETE, HttpMethod.PATCH));

/** Default name of the form parameter with the HTTP method to use. */
public static final String DEFAULT_METHOD_PARAMETER_NAME = "_method";

method put, delete, patch 사용가능해짐

(detail.html)
<input type="hidden" name="_method" value="DELETE">
(application.properties)
spring.mvc.hiddenmethod.filter.enabled=true



수정기능 구현
https://www.w3schools.com/jquery/default.asp
jQuery 사용할거야 jQuery CDN > Google CDN:
<head>태그 안쪽에 넣어주면 j쿼리 사용가능함(타이틀 아래에 넣어줬는데 head안에 넣기만하면 됨)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>

https://www.w3schools.com/jquery/jquery_syntax.asp
The Document Ready Event
$(function(){
  // jQuery methods go here...
});