我想在web端执行删除文件操作,一开始想参考表单验证中,
url:'',
success:funtion(){}
但未能成功,于是使用了window.location.href,结果删除功能确实实现了,但删错操作后,页面总是会跳转到一个空页面上。
求问各位大神有什么办法,给个提示。谢谢!
js代码:
window.location.href = 'deleteFile?id='+rs[0].data.fileId; Ext.Msg.alert('系统提示','成功删除文件');
struts.xml中
java文件
package com.refeiner.action.files;
import com.opensymphony.xwork2.ActionSupport;
import com.refeiner.service.FileOps;
import java.io.InputStream;
public class DeleteAction extends ActionSupport{
private static final long serialVersionUID = 1L;
protected FileOps fileOps;
public void setFileOps(FileOps fileOps) {
this.fileOps = fileOps;
}
private Integer id;
public void setId(Integer id) {
this.id = id;
}
public String execute() throws Exception{
System.out.println("指针1");
fileOps.deleteFileLocationToDB(id);
return SUCCESS;
}