0
我期待Web調用的BigDecimal.toString()值。如何讓ajax在Spring MVC中調用文本到Java控制器?
,但我不設法對其進行配置和獲取爲404,未找到或406
以下是Spring MVC的代碼
@RequestMapping(value="get/myData", method = RequestMethod.GET, produces = MediaType.TEXT_PLAIN_VALUE)
@ResponseBody
public String getMyData(@ModelAttribute("user") User user,
@ModelAttribute("detailForm") DetailForm form)
{
//A web service called return big decimal and return that big decimal value toString
return "Value";
}
以下是調用代碼:
var convId = $("#" + $("body form:first").attr("id")).find('input[name="_CONV_ID"]').val();
blockUI: false,
dataType: 'text',
type: 'GET',
url: "get/myData.do",
data: { '_CONV_ID': convId},
success: function (data) {
// new dialog
alert(data);
},
error: function (result) {
alert("Error" + result);
}
任何人都可以幫助我調整代碼。在按鈕點擊時,值從BigDecimal類型的網絡服務返回
您的ajax請求中的網址對我來說似乎不真實。試試:'get/myData.do' - >'get/myData' – Deh
不是這個問題 – fatherazrael
你是否同時提交表單? – Deh