请教一个问题,在jsp文件中,怎么通过输入流,输出流像服务器写文件啊,我像本地文件写呢,可是放到jsp中,上传服务器,怎么说我路径不对啊,我改了路径啊
请教一个问题,在jsp文件中,怎么通过输入流,输出流像服务器写文件啊,我像本地文件写呢,可是放到jsp中,上传服务器,怎么说我路径不对啊,我改了路径啊不晓得像服务器上写文件要别的东西吗
<%FileWriter out1=new FileWriter("/2.js"); 地址是这么写吗
BufferedWriter outbuffer=new BufferedWriter(out1);
outbuffer.write("var interval_time=5\r\n");
outbuffer.write("var focus_width=260\r\n");
outbuffer.write("var focus_height=180\r\n");
outbuffer.write("var text_height=18\r\n");
outbuffer.write("var text_align= 'center'\r\n");
outbuffer.write("var swf_height = focus_height+text_height\r\n");
outbuffer.write("var pics= 'image/4.jpg|image/1.jpg|image/2.jpg|image/3.jpg'\r\n");
outbuffer.write("var links='");
outbuffer.write(s[0]);
outbuffer.write("|");
outbuffer.write(s[1]);
outbuffer.write("|");
outbuffer.write(s[2]);
outbuffer.write("|");
outbuffer.write(s[3]);
outbuffer.write("\r\n");
outbuffer.write("var texts='");
outbuffer.write(s[4]);
outbuffer.write("|");
outbuffer.write(s[5]);
outbuffer.write("|");
outbuffer.write(s[6]);
outbuffer.write("|");
outbuffer.write(s[7]);
outbuffer.write("\r\n");
outbuffer.write("document.write('<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\"\r\n");
outbuffer.write("codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\"'+ focus_width +'\" height=\"'+ swf_height +'\">');\r\n");
outbuffer.write("document.write('<param name=\"movie\" value=\"pixviewer.swf\"><param name=\"quality\" value=\"high\"><param name=\"bgcolor\" value=\"#ffffff\">');\r\n");
outbuffer.write("document.write('<param name=\"menu\" value=\"false\"><param name=wmode value=\"opaque\">');\r\n");
outbuffer.write("document.write('<param name=\"FlashVars\" value=\"pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'&text_align='+text_align+'&interval_time='+interval_time+'\">');\r\n");
outbuffer.write("document.write('<embed src=\"pixviewer.swf\" wmode=\"opaque\" FlashVars=\"pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'&text_align='+text_align+'&interval_time='+interval_time+'\" menu=\"false\" bgcolor=\"#ffffff\" quality=\"high\" width=\"'+ focus_width +'\" height=\"'+ swf_height +'\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />');\r\n");
outbuffer.write("document.write('</object>');\r\n");
outbuffer.flush();
outbuffer.close();
out.println("上传成功");
out.println("数据为:");
for(int i=0;i<8;i++)
out.println("<br>"+s[i]);
%>
搜索更多相关主题的帖子:
jsp bean
----------------解决方案--------------------------------------------------------
我之前做过一个STRUTS框架的上传功能 处理过类似问题(代码忘记在哪了,找到了传上来)
你可以打印你的地址
看看是否正确
然后进行修改
----------------解决方案--------------------------------------------------------
回复 2楼 elan1986
谢谢,往本地可以写,网服务器上写,说目录不正确,不晓得这个目录怎么写,或者还要什么别的东西 ----------------解决方案--------------------------------------------------------