我有一个spring 3应用程序,我正在使用jquery发布ajax请求。现在我想在ajax响应结束后将我的页面重定向到另一个页面。 Pojo由第一个页面控制器返回,该控制器将传递给第二个控制器。我知道如何重定向,但不知道如何将这个POJO传递到一个表单控制器如何使用值对象重定向另一个页面
$.ajax({
type: "POST",
url: "/xxx/xxx/xxx/accept",
data: "bId=" + bId+
"&minDelTime=" +minDelTime,
success: function(response){
if(response.errorText == null) {
//this works fine
alert(response.orderId);
//this is where i have to redirect with response as parameter
window.location.replace("/xxx/xxx/xxx/confirm/"+response.orderId);
} else {
alert(response.errorText);
}
},
我的下一个页面控制器 -
@Controller
@RequestMapping("/xxx/xxx/confirm")
public class ConfirmationController {
@RequestMapping(value = "/orderVo", method = RequestMethod.GET)
public String showOrderConfirmPage(@PathVariable MasterVo orderVo, Model model) {
LOGGER.info("Entry showOrderConfirmPage()");
LOGGER.debug("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ : " + orderVo.toString());
LOGGER.info("Exit showOrderConfirmPage()");
return "/xxx/orderConfirmView";
}
}
但我总是得到错误。有人可以告诉我如何将对象(Pojo)传递给新页面控制器吗?
更新 -
我试图序列化对象 -
success: function(response){
if(response.errorText == null) {
$.post("orderVo", response.serialize(), function(data) {
window.location.replace("/xxx/xxx/xxx/confirm/");
});
但我正在逐渐遗漏的类型错误:对象#有没有方法 '连载'
是我使用jQuery和更新了我的代码上面,但现在我得到遗漏的类型错误:对象#
当这些数据从何而来? jQuery在html和表单上运行。你必须序列化表单,而不是对象(在jQuery中)。 – Kamil 2012-02-19 18:44:18
是的,这是问题,数据来自Spring控制器类作为Java POJO对象,我想将该对象传递给另一个控制器 – Sachin 2012-02-19 18:54:47