关于Spreadsheet的问题,找不到文件?

RotKang 2009-07-29 12:34:59
页面中: window.onload=function(){
var spreadSheet = document.getElementById('mySpreadsheet');
var path = "test.xml";
try{
spreadSheet.XMLURL="query.do?cs=info&path="+path;
spreadSheet.refresh();
}catch(ex){
alert('文件不存在!');
}
}
<object id="mySpreadsheet"classid="CLSID:0002E559-0000-0000-C000-000000000046"
style="width:100%;height:400">
</object>


action中:
public ActionForward info(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
OutputStream os = null;
InputStream in = null;
String path=request.getParameter("path");
path=request.getSession().getServletContext().getRealPath("/")+path;
File file = new File(path);
if(!file.exists()){
System.out.println("文件不存在!");
}
try{
response.setContentType("application/unknown");
response.setHeader("Content-Disposition", "attachment; filename=test.xml");
os=response.getOutputStream();
in = new FileInputStream(file);
byte bytes[] = new byte[1024];
for(int len = 0; (len = in.read(bytes)) != -1;)
os.write(bytes, 0, len);
}catch(Exception e){
e.printStackTrace();
}finally{
os.flush();
if(null != in)
in.close();
if(null != os)
os.close();
}


return null;
}

为什么会找不到文件?
...全文
141 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
RotKang 2009-07-29
  • 打赏
  • 举报
回复
在线等高手出现...........

67,512

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧