sirius-snow

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

 

分类:

技术点:

相关文章:

  • 2021-12-27
  • 2022-12-23
  • 2022-02-09
  • 2021-11-27
  • 2022-01-23
  • 2022-02-08
  • 2021-12-27
  • 2021-06-21
猜你喜欢
  • 2022-01-24
  • 2022-01-26
  • 2021-12-09
  • 2021-11-30
  • 2021-11-17
  • 2022-12-23
  • 2021-12-27
相关资源
相似解决方案