1
我使用包括ajax在內的struts 2來上傳文件,下載時一切正常,我得到文件,但上傳 文件後執行的操作返回的響應頁面是完全扭曲的,它在我的base.js返回一個錯誤:($ ajaxSetup({沒有定義) 這裏稱爲挽救我的文件中的操作使用ajax上傳文件的struts 2
public String saveFile() throws Exception {
if(uploadFileName!=null){
String chemin=context.getRealPath("");
File dirWebapps = new File(chemin);
String fullFileName =myUrl+"/"+uploadFileName;
File theFile = new File(dirWebapps.getParent(),fullFileName);
FileUtils.copyFile(upload, theFile);
URL repertoire = theFile.getParentFile().toURL();
}
return "myPage";
}
請,有人可以幫助我
我在struts.xml文件中定義一個bean上傳如下:
和 「我的空間」 載
<%@ taglib prefix="s" uri="/struts-tags"%> <%@ page contentType="text/html; charset=utf-8"%> <%@ taglib prefix="sj" uri="/struts-jquery-tags"%> <script type="text/javascript" src="js/base.js"></script> <script type="text/javascript"> $(function(){ ///something }) </script> <s:form id="courrierModel" validate="true" theme="simple" cssStyle="margin:0;padding:0px" enctype="multipart/form-data" method="GET"> some content </s:form>
可能重複[如何在文件下載後返回到結果頁?](http://stackoverflow.com/questions/7835088/how-to-return-to-a-result-page -after-file-download) – BalusC
答案與上次提問相同:) –
我嘗試用另一種方式說,因爲答案沒有幫助我 – user1005045