码迷,mamicode.com
首页 > Web开发 > 详细

AJAX提交跳转页面

时间:2015-03-02 12:46:11      阅读:148      评论:0      收藏:0      [点我收藏+]

标签:

在使用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();

 

AJAX提交跳转页面

标签:

原文地址:http://www.cnblogs.com/sirius-snow/p/4308263.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!