반응형
$.ajax({
    url: "http://127.0.0.1:8080/ocr_search/engine", // Generally use Controller URI
    type: "GET", // GET, POST
    data: {
        status : "200",
        id : "hello",
        shaAdminPw : "hhh",
        type : "f"
    },
    //async : false, // Async 
    success : (result) => console.log(result), //when you success, you can handle it
    fail : (error) => console.log(error), // when you fail, you can handle it
    complete : (finalResult) => console.log(finalResult) // it runs, whenever you fail or success
});

 

@RequestMapping(value = "/engine", method = RequestMethod.GET)
public void engine(EngineDto engineDto) {
	System.out.println(engineDto.getId()); // hello
}
public class EngineDto {

	private String status = "";
	private String id = "";
	private String shaAdminPw = "";
	private String type = "f";

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getShaAdminPw() {
		return shaAdminPw;
	}

	public void setShaAdminPw(String shaAdminPw) {
		this.shaAdminPw = shaAdminPw;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}
	
}

해당 객체에 setter만 있으면 알아서 잘 data-binding 됩니다.

 

반응형