sharke3
1k
2017-11-14 11:38:55 작성 2017-11-14 15:37:29 수정됨
0
1053

JQUERY AJAX 실행 시 400 에러 - BOOLEAN값을 매핑 시 문제 발생


SPRING 5.0.1 DOMAIN-DRIVEN-DESIGN ,  LOMBOK, POSTGRESQL 


이전에는 잘 되다 BOOLEAN값을 매핑하니까 문제가 생기고 구글링으로 보이는 거 다 해봤는데 

잘 안됩니다. 


-JAVASCRIPT 변수 명에 FLG가 붙은 것은 BOOLEAN입니다. 추가하니 에러가 나네요.

$.ajax({
					        type: "POST",
					        url: "/fgappp/updateMyPageInfo.do",
					        data: {   "myPageId" : "mpid"
					        		, "producerNm":app.mypage_info.producerNm.value
					        		, "producerAddress":app.mypage_info.producerAddress.value
					        		, "producerAddressFlg":app.mypage_info.producerAddressFlg.value
				        			, "producerEmail":app.mypage_info.producerEmail.value
				        			, "producerEmailFlg":app.mypage_info.producerEmailFlg.value
				        			, "producerTelno":app.mypage_info.producerTelno.value
				        			, "producerTelnoFlg":app.mypage_info.producerTelnoFlg.value
						        	, "producerHomepage":app.mypage_info.producerHomepage.value
						        	, "producerIntro":app.mypage_info.producerIntro.value
						        	, "producerPicture":app.mypage_info.producerPicture.value
					        },
					        dataType: "json",
					        success: function (data) {
					        	console.log(data);
					        }
					    }).fail(function () {
						})


-JAVA    js에서 보낸 파라미터는 UpdateMyPageInfoRequest이걸로 받는데 왜 BOOLEAN만 문제가 될까요.

@RequestMapping(value = "updateMyPageInfo.do", produces="application/json;charset=UTF-8")
	public @ResponseBody String UpdateMyPageInfo(
			@Valid UpdateMyPageInfoRequest request,
			@CookieValue(value="fgappp_sid", required=false) SessionId sessionId,
			BindingResult errors,
			HttpServletResponse response) throws Exception {
    	response.setContentType("application/json");
	response.setCharacterEncoding("UTF-8");
				
	MyPageId myPageId = sessionService.getMyPageId(sessionId);
		
	loginLandingService.updateMyPageInfo(myPageId, request.createEntity());

	return "OK";
}


-UpdateMyPageInfoRequest 

@ToString
public class UpdateMyPageInfoRequest {

	@Getter
	@Setter
	@NotNull
	@Valid
	private MyPageId myPageId;
	
	@Getter
	@Setter
	@NotNull
	@Valid
	private ProducerNm producerNm;

	@Getter
	@Setter
	@NotNull
	@Valid
	private ProducerAddress producerAddress;

	@Getter
	@Setter
	@NotNull
	@Valid
	private ProducerAddressFlg producerAddressFlg;

	@Getter
	@Setter
	@NotNull
	@Valid
	private ProducerEmail producerEmail;

	@Getter
	@Setter
	@NotNull
	@Valid
	private ProducerEmailFlg producerEmailFlg;

	@Getter
	@Setter
	@NotNull
	@Valid
	private ProducerTelno producerTelno;

	@Getter
	@Setter
	@NotNull
	@Valid
	private ProducerTelnoFlg producerTelnoFlg;
	@Getter
	@Setter
	@NotNull
	@Valid
	private ProducerHomepage producerHomepage;

	@Getter
	@Setter
	@NotNull
	@Valid
	private ProducerIntro producerIntro;
	@Getter
	@Setter
	@NotNull
	@Valid
	private ProducerPicture producerPicture;
	
	public MyPageEntity createEntity() {
		return new MyPageEntity(myPageId, producerNm, producerAddress, producerAddressFlg, producerEmail, producerEmailFlg, producerTelno, producerTelnoFlg, producerHomepage, producerIntro,  producerPicture);
	}
	
	
}


-MyPageEntity

@AllArgsConstructor
@ToString
public class MyPageEntity {

	@Getter
	private MyPageId myPageId;
	
	@Getter
	private ProducerNm producerNm;

	@Getter
	private ProducerAddress producerAddress;

	@Getter
	private ProducerAddressFlg producerAddressFlg;

	@Getter
	private ProducerEmail producerEmail;

	@Getter
	private ProducerEmailFlg producerEmailFlg;

	@Getter
	private ProducerTelno producerTelno;

	@Getter
	private ProducerTelnoFlg producerTelnoFlg;
	
	@Getter
	private ProducerHomepage producerHomepage;

	@Getter
	private ProducerIntro producerIntro;

	@Getter
	private ProducerPicture producerPicture;

}


0
  • 답변 0

  • 로그인을 하시면 답변을 등록할 수 있습니다.