분류 전체보기 645

[Error] Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported

Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported Form을 submit으로 서버에 요청을 보내면서 발생한 에러다. 이전에는 AJAX로 요청을 보내서 @RequestBody가 컨트롤러에서 있었다. 하지만, submit으로 요청을 보내게 되면 @RequestBody가 필요없고 위와 같은 에러가 생긴다. 더이상 쓸모없는 @RequestBody를 없애면 에러가 해결된다. 👇 참고 https://stackoverflow.com/questions/33796218/content-type-application-x-www-form-urlencodedcharset-utf-8-not-supported-for Content type 'a..

SQL Injection

SQL 인젝션 DB와 연동된 web application에서 공격자가 조작된 질의문을 삽입해서 웹 서비스의 데이터베이스 정보를 열람/조작할 수 있는 취약점 ex) SELECT * FROM USERS WHERE name='test' And password='123' or '1'='1' Parameter Binding 출발지에서 목적지로 전송되는 정보다. 출발지에서 가져온 name과 value를 가지고 있다. object key 또는 attribute values는 parameter binding에 의해 전달된다. Spring Data JPA는 Parameter Binding을 사용한다. 예시) String prepareStatementQuery="SELECT * FROM USERS WHERE name=? ..

DB 2022.08.30

업로드 파일 사이즈

org.apache.tomcat.util.http.fileupload.impl.FileSizeLimitExceededException: The field file exceeds its maximum permitted size of 1048576 bytes. 이미지 파일 하나 업로드하니까 다음과 같은 에러 발생 기본값이 1048576 bytes 🌿 해결 spring.servlet.multipart.max-file-size=5MB spring.servlet.multipart.max-request-size=10MB build.gradle에 추가하자. max-file-size는 허용 가능한 최대 바이트 사이즈다. 업로드한 파일 중에서 max-file-size를 초과하는 파일이 있다면, IllegalStateEx..

JavaScript에서 model 값 가져오기

JS에서 model의 값에 접근하고 싶었다. Thymeleaf의 th:inline을 사용한다. 스크립트 태그에 th:inline="javascript"를 추가했다. 참고) th:inline의 값으로는 text, none도 있다. var post_id=[[${post.id}]]; 이렇게 사용한다. Strings, Numbers, Booleans, Arrays, Collections, Maps, Beans(objects with getter and setter methods) 타입을 사용할 수 있다. 참고 👇 https://kimfk567.tistory.com/105 타임리프 js에서 model 데이터 받기 ( th:inline ) 현재 타임리프를 사용하고 있지만, 전에는 jsp를 사용했었다. 컨트롤러에서 ..

FE/html 2022.08.13

조회 시 HTML 태그가 출력될 때(feat. Summernote)

Summernote 에디터를 이용해 저장하고 조회하니 HTML 태그까지 같이 출력되었다. Thymeleaf를 사용했기 때문에 th:utext를 이용하는 것으로 해결했다. th:utext는 unescaped text다. 참고 👇 https://velog.io/@hellocdpa/220307-SpringBoot-%ED%83%80%EC%9E%84%EB%A6%AC%ED%94%84-%EC%8D%B8%EB%A8%B8%EB%85%B8%ED%8A%B8summernote-%EC%A0%80%EC%9E%A5%EA%B3%BC-%EC%A1%B0%ED%9A%8C [22/03/06] SpringBoot 타임리프 썸머노트(summernote) 저장과 조회 게시판 글 작성란이 조금 밋밋한 것 같아서 summer note를 추가해보았다..

FE/html 2022.08.04

Uncaught TypeError: $.ajax is not a function

consol에 Uncaught TypeError: $.ajax is not a function 에러가 뜬다. slim build를 사용해서 기능이 많이 빠진다. ✨ 해결 uncompressed를 가져왔다. 참고 👇 https://releases.jquery.com/jquery/ jQuery Core – All Versions | jQuery CDN jQuery Core – All Versions jQuery Core & Migrate - Git Builds UNSTABLE, NOT FOR PRODUCTION jQuery Core - All 3.x Versions jQuery Core 3.6.0 - uncompressed, minified, slim, slim minified jQuery Core 3.5...

FE/html 2022.08.04

Uncaught TypeError: $(...).summernote is not a function

summernote를 사용하려고 했는데 적용이 안 된다. 공통 html common의 head를 가져와서 쓰고 있었다. common.html의 CDN ✨ 해결 th:replace를 th:insert로 바꿨다. th:replace는 모두 다 교체, insert는 추가 지금 내 상황에서 필요한 것은 추가다. 참고 👇 https://summernote.org/getting-started/#compiled-css-js Summernote - Super Simple WYSIWYG editor Super Simple WYSIWYG Editor on Bootstrap Summernote is a JavaScript library that helps you create WYSIWYG editors online. sum..

FE/html 2022.08.03