분류 전체보기 645

[CSS] pagination과 버튼 나란히 두기

쓰기 Previous 1 Next ul 태그에 margin-top:0을 줬다. 쓰기 버튼이 페이지네이션보다 밑에 있으면 두 개를 수평으로 두는 게 안 된다. 쓰기 버튼을 감싸고 있는 div 태그는 블록레벨이기 때문에 한 행을 혼자 다 차지한다. 참고 👉 https://stackoverflow.com/questions/19768389/bootstrap-alignment-of-button-and-pagination Bootstrap alignment of button and pagination I am using Twitter Bootstrap 3 to build my new website. I want to place a button on the left side and a pagination on the..

FE/html 2021.12.02

[ERROR] org.thymeleaf.exceptions.TemplateProcessingException: Exception evaluating SpringEL expression: "#temporals.createDate(post.createdDate, 'yyyyMMdd')"

org.thymeleaf.exceptions.TemplateProcessingException: Exception evaluating SpringEL expression: "#temporals.createDate(post.createdDate, 'yyyyMMdd')" java.time.format.DateTimeParseException: Text '21. 11. 25. 오후 7:32' could not be parsed at index 0 에러 로그 ✨ 해결 작성일자를 출력한다. "#temporals.createDate(post.createdDate, 'yyyyMMdd')"을 위와 같이 고쳤다. 참고 👉 https://azurealstn.tistory.com/93 [스프링 부트로 게시판 만들기] 09...

FE/html 2021.11.26

Spring Security 사용자 id 가져오기

Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal(); String username = ((UserDetails)principal).getUsername(); 작성한 글을 저장할 때 작성자를 로그인 한 id로 해주었다. 위의 코드를 추가하면 로그인 한 유저의 id를 가져올 수 있다. 참고 👉 https://dzone.com/articles/how-to-get-current-logged-in-username-in-spring-se Spring Security: Access Current Logged-In Username - DZone Security This tutorial demonstrates ho..

[ERROR] EL1004E: Method call: Method hasError(java.lang.String) cannot be found on type org.thymeleaf.spring5.expression.Fields

🦔 에러 로그 Exception evaluating SpringEL expression: "#fields.hasError('content')" (template: "post/detail" - line 49, col 27) EL1004E: Method call: Method hasError(java.lang.String) cannot be found on type org.thymeleaf.spring5.expression.Fields s를 빼먹어서 생긴 에러였다 ㅠㅠ "#fields.hasErrors('content')"가 맞다.

form을 submit하는 3가지 태그(button, a, input)

Logout 버튼 태그를 아래처럼 해도 동작할 줄 알았다. 참고로 버튼의 타입은 기본값이 submit이다. Logout a 태그를 쓰고 role="button"을 했지만, 동작하지 않았다. 🦄 버튼 태그 대신에 쓸수 있는 방법 input 태그와 type="submit"을 쓰는 방식은 많이 쓰인다고 한다. Logout a 태그가 속한 form의 id를 test로 했다. document.getElementById로 test 아이디를 가진 form을 가져오고, 전송한다. 스택오버플로우를 참고했다. 참고 👉 https://webdir.tistory.com/421 input type="submit" vs button 비교 프로젝트를 진행하면서 로 폼의 내용을 전달하는 경우를 많이 접하게 되었습니다. 습관적으로 b..

FE/html 2021.11.24

[ERROR] java.sql.SQLException: Field 'title' doesn't have a default value

java.sql.SQLException: Field 'title' doesn't have a default value 처음에는 title 컬럼을 not null에서 null로 변경해주니 해결 @Column(name="post_id", nullable=false) private String title; 진짜 원인은 이 부분에 있다. post 엔티티에 title의 컬럼이 post_id로 해놨네 어쩐지 title에 안 들어가고 post_id로 들어가더라..(언제 저렇게 한거지??) 컬럼 title을 not null로 해놔서 에러가 생긴거였다. name="post_id" 없애고, post_id 컬럼도 삭제했다. 참고 👉 https://wickedmagic.tistory.com/534 [MySQL] Field '..

DB 2021.11.21

[Thymeleaf] 로그인, 로그아웃 버튼

🦔 먼저 implementation 'org.springframework.boot:spring-boot-starter-security' implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity5' build.gradle의 dependencies에 추가해줬다. 로그인 로그아웃 로그아웃할 때는 따로 컨트롤러를 만들지 않아도 된다. 로그인과 로그아웃 버튼 둘중 하나만 보인다. 참고 👇 https://www.thymeleaf.org/doc/articles/springsecurity.html Thymeleaf + Spring Security integration basics - Thymeleaf Have you switched to Thymelea..

FE/html 2021.11.19

[MySQL] Error Code : 3780

alter table user_role add foreign key (role_id) REFERENCES role (id), add foreign key (user_id) references user(id); 외래키 추가하다가 에러가 떴다. Error Code: 3780. Referencing column 'user_id' and referenced column 'id' in foreign key constraint 'user_role_ibfk_2' are incompatible. 0.000 sec bigint 타입인줄 알았는데 아니었다. 타입을 통일시켜준 뒤에 문제를 해결했다. 참고 👉 https://journeytosth.tistory.com/97 [MySQL] FK 추가 - ERROR 3780 해결..

DB 2021.11.19

[파이썬, Java] 16926. 배열 돌리기 1

문제 크기가 N×M인 배열이 있을 때, 배열을 돌려보려고 한다. 배열은 다음과 같이 반시계 방향으로 돌려야 한다. A[1][1] ← A[1][2] ← A[1][3] ← A[1][4] ← A[1][5] ↓ ↑ A[2][1] A[2][2] ← A[2][3] ← A[2][4] A[2][5] ↓ ↓ ↑ ↑ A[3][1] A[3][2] → A[3][3] → A[3][4] A[3][5] ↓ ↑ A[4][1] → A[4][2] → A[4][3] → A[4][4] → A[4][5] 예를 들어, 아래와 같은 배열을 2번 회전시키면 다음과 같이 변하게 된다. 1 2 3 4 2 3 4 8 3 4 8 6 5 6 7 8 1 7 7 6 2 7 8 2 9 8 7 6 → 5 6 8 2 → 1 7 6 3 5 4 3 2 9 5 4 3 ..

coding test 2021.11.15