0
내가 내 REST 서비스 호출 내부 Ajax 요청이 방법REST 서비스 호출에서 입력 매개 변수를받는 방법은 무엇입니까?
$.ajax({
type: 'GET',
url: 'http://hosti[:8080/OrderSnacks/oms/toppings?topping=' + id_attr_val,
jsonpCallback: 'jsonCallback',
cache: true,
dataType: 'jsonp',
jsonp: false,
success: function (response) {
console.log(response);
},
error: function (e) {
$("#divResult").html("WebSerivce unreachable");
}
});
});
을 수행하고, 나는 내가
public String getData(@QueryParam("toppingid") String toppingid) {
}
public String getData(@PathParam("toppingid") String toppingid) {
}
입니다 모든 옵션을 시도
@Path("/toppings")
public class ToppingService {
@GET
@Consumes("application/text")
@Produces("application/json")
public String getData(@PathParam("toppingid") String toppingid) {
return "";
}
이 매개 변수를받을 수 없습니다입니다
하지만 아무 것도 작동하지 않습니다.
이러한 매개 변수를받는 방법을 알려주십시오.
감사합니다. QueryParam 또는 PathParam을 사용해야합니까 – Pawan
귀하의 경우에는 PathParam을 사용하십시오. 차이점을 확인하십시오. http://stackoverflow.com/a/11569077/1392463 – Ioan
대단히 감사합니다. – Pawan