我通过访问action.test.input返回test.jsp,然后在test页面中填写参数后,再用test.js发给action.test.save,然后想跳转到list.jsp,为什么一直不行呢?
Action代码是这样的:
@IocBean
@At("/action/test")
public class TestAction {
@At("/input")
@Ok("jsp:jsp.test")
public void loginOut() {
System.err.println("list");
}
@At("ve")
@Ok("jsp:jsp.list")
public void receiver(HttpServletRequest req) {
System.err.println("接收参数");
System.err.println(req.getParameter("name"));
}
}
页面test.jsp:
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
test
提交
对应的test.js:
$(document).ready(function(){
$("#senddata").click(function(){
var parameter = {
name:'zhangsan'
};
var local = window.location;
var contextPath = local.pathname.split("/")[1];
var basePath = local.protocol+"//"+local.host+"/"+contextPath+"/action/test/save";
//$post()发送请求
$.post(basePath, {
name:'zhangsan'
},function(data){
//alert(data);
});
});
});
结果,访问正常,访问action.test.input,提交action.test.save也正常,就是无法跳转到list.jsp,,未报任何异常,list.jsp路径和test.jsp在同一路径,路径正确,求大神指点