Solution:
Javascript before page Jump:
// Preview the attachment function Preview () {var keywordid =$ {keyword. ID} + ""; $. Post ("$ {URL}/event! Preview. Action ", {kwid: keywordid}, function (data, status) {If (Data =" noexists ") {alert (" the attachment does not exist. Please add it as an attachment! "); Return;} else {// window. Open ('$ {URL}/yq/yqpublication! Preview. Action? Indexno = '+ indexno, 'newwindow', 'toolbar = No, menubar = No, scrollbars = No, resizable = Yes, location = No, status = no '); // window. open ('$ {URL}' + data, 'previewwindow', 'toolbar = No, menubar = No, scrollbars = No, resizable = Yes, location = No, status = no'); // location. href = '$ {URL}' + data; var isie = !! Window. activexobject; var isie6 = isie &&! Window. XMLHttpRequest; var isie8 = isie &&!! Document.doc umentmode; var isie7 = isie &&! Isie6 &&! Isie8; If (isie) {If (isie6) {window. open ('$ {URL}' + data); // alert ("IE6");} else if (isie8) {window. open ('event! Download. Action? Url = '+' $ {URL} '+ data); // alert ("IE8");} else if (isie7) {window. Open ('event! Download. Action? Url = '+' $ {URL} '+ data); // alert ("IE7");} else {window. open ('$ {URL}' + data); // alert ("not supported by other browsers currently ");}}}});}
Processing in action:
Public String download () throws exception {try {string url = struts2utils. getrequest (). getparameter ("url"); If (validator. isnotnull (URL) {struts2utils. getrequest (). setattribute ("url", URL);} // struts2utils. getresponse (). getwriter (). write ("<SCRIPT> location. href = 'event! Download. Action? Url = "+ URL +" '; </SCRIPT> "); // struts2utils. getresponse (). sendredirect (URL);} catch (exception e) {logger. error ("preview download briefing error", e);} return "Download ";}
Returned page:
<% @ Page contenttype = "text/html; charset = UTF-8" %> <% @ include file = "/common/Common. JSP "%> <% @ taglib uri =" http://java.sun.com/jsp/jstl/fmt "prefix =" FMT "%> <HTML>