标签:
在使用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();
标签:
原文地址:http://www.cnblogs.com/sirius-snow/p/4308263.html