0
我在jquery中做了一個ajax Rest調用,它應該返回一個我想要在jsp中顯示的bean列表。我能夠進行Rest調用,但我無法得到如何在ajax調用中獲得結果並在頁面中顯示它。與Ajax調用Java與jquery和ajax的其餘調用
jsp頁面
<script type="text/javascript">
$(document).ready(function(){
$('#abcForm').submit(function(){
var v = $('#abc').val();
$.ajax({
type: "GET",
dataType: "jsonp",
url: "http://localhost:8080/RestTest/rest/hello/"+v,
});
});
});
</script>
Java代碼
@Path("hello")
public class RestController {
@GET
@Path("{param}")
public Response getMsg(@PathParam("param") String msg) {
String output = "Hello : " + msg;
return Response.status(200).entity(output).build();
}
}
因此,實際上將有來自Java類REST調用,它將返回其需要將顯示一個列表將jsp頁面作爲ajax調用。這是我卡住的地方。
需要幫助。
感謝
我試過'回調success'功能,做提醒數據,但它沒有顯示這個代碼 – astar