用了很长时间调试这个url跳转的问题.
1. 在没有用ajax发送http请求的时候,在controller中可以通过return "redirect:/user/list";的方式进行页面跳转.
2.在使用ajax对表单数据进行封装,并发送至controller进行处理后就不能用以往的方法进行处理, 而需要在ajax提交的函数里进行跳转的设置:
$("#feedback").html("信息更新成功,点击<a href='/user/list'>此处</a>返回。");
function _submit() {
$.ajax({
type: "POST",
url: "/user/update",
contentType: "application/json;charset=UTF-8",
data: getJsonFromInputs(["userId", "nickname", "realname", "email", "password"]),
dataType: "json",
success: function (data) {
$("#feedback").html("信息更新成功,点击<a href='/user/list'>此处</a>返回。");
}
})
}