[html+spring]하면서난 오류들(1/1)

allnight5·2023년 2월 14일
0

스프링

목록 보기
51/62
  1. get과 post의 차이점
    visual studio code에서 post를 쓸때는 RequestBody가 되지만 get을 사용해서 데이터를 보낼때에는 RequestParam을 사용해야한다.

  2. get을 이용하여 스프링으로 데이터를 보내는법

		var settings = {
"url": "http://localhost:8080/api/findbyusername?email="+$('#getfindemail').val()+"&name="+$('#getfindname').val(),
			"method": "GET",
			"timeout": 0,
		};
        
        
		$.ajax(settings).done(function (response) {
		console.log(response);
		let getusername = response['username']
		alert(getusername)
        }).fail(function (response){
            console.log(response.status);
            if(response.status === 404){
                alert("이메일이 존재하지 않습니다."); 
            }else{
                alert("서버에 문제가 발생하였습니다."); 
            }
        }); 
	}

input을 기준으로한다. textArea도 데이터를 전송할때의 값을가져다가 쓰면된다.

  1. 카카오지도를 할때 지도가 안나올때의 상황중하나
    플랫폼으로 이동 -> Web -> 사이트 도메인에 내가 입력한게 없음
    http://localhost
    http://localhost:5500
    http://127.0.0.1:5500

이런식으로 같은 로컬이지만.. 다 써줘야 거기서 동작한다. 만약에.. pathvaliable 사용할때는 어떻게 되는걸까? 두렵다.

  1. $을 찾을수없습니다(혹은 인식할수없습니다)

    <script src="https://code.jquery.com/jquery-3.6.0.js" integrity="sha256-H+K7U5CnXl1h5ywQfKtSj8PCmoN9aaq30gDh27Xc0jk=" crossorigin="anonymous"></script>

    jquery를 넣어주지 않아서 그런다 쓰려면 잊어버리지 말고 넣어주도록하자

  2. Failed to parse multipart servlet request
    @RequestPart("CreatePostGymRequestDto")
    @RequestPart("file")
    multi로 하다가 다시 html 쪽은 body형태로 바꿨는데
    file 만 삭제해주고
    @RequestBody로 바꿔주지 않아서 난 에러
    html에서 보내오는 형태가 다르기때문에 나는 에러다

profile
공부기록하기

0개의 댓글