AJAX提交跳转页面
在使用AJAX提交访问时对跳转网页基本不支持:
经查询解决方案为:
1)JS前台进行跳转 ;
2)后台返回脚本流:
STRUTS2
struts.xml -->
<action name="login" method="login" class="com.hope.action.LoginAction"> <param name="code">string</param> <param name="pass">string</param> <result name="login" type="stream"> <param name="contentType"> text/html;charset=UTF-8 </param> <param name="inputName">json</param> </result> <result name="error" type="stream"> <param name="contentType"> text/html;charset=UTF-8 </param> <param name="inputName">json</param> </result> </action>
Action.java
private InputStream json; String url = "<script language=\"JavaScript\">window.top.location.href = \"../index.jsp\";</script>"; byte[] data = url.getBytes(); this.json = new ByteArrayInputStream(data);
SPRING MVC
1 OutputStream outputStream =null; 2 String url = "<script language=\"JavaScript\">window.top.location.href = \"../index.jsp\";</script>"; 3 byte[] data = url.getBytes(); 4 outputStream =response.getOutputStream(); 5 outputStream.write(data); 6 outputStream.flush(); 7 outputStream.close();
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。