1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > html转jsp后空白页 netbeans 运行这个JSP 页面 结果是空白页。.

html转jsp后空白页 netbeans 运行这个JSP 页面 结果是空白页。.

时间:2021-05-18 05:04:54

相关推荐

html转jsp后空白页 netbeans 运行这个JSP 页面 结果是空白页。.

downfile.jsp

显示下载

您已经上传的文件:

String path=request.getSession().getServletContext().getRealPath("/");

File file1=new File(path,"//upload");

String str[]=file1.list();

for(int i=0;i

String ss=str[i];

out.println("

"+ss+"下载");

}

%>

downfile1.jsp

Document : Downfile1

Created on : -4-22, 18:18:37

Author : Administrator

--%>

try{

String str=request.getParameter("name1");

str=new String(str.getBytes("ISO-8859-1"),"gb2312");

File fileLoad=new File("F://大二课程//JSP//JSP程序设计与项目实训教程教学资料//代码//ch10//PIMS//build//web//upload",str);

response.reset();

OutputStream o=response.getOutputStream();

BufferedOutputStream bos=new BufferedOutputStream(o);

byte b[]=new byte[5000];

response.setHeader("Content-disposition","attachment;filename="+new String(str.getBytes("gb2312"),"ISO-8859-1"));

response.setContentType("application/x-tar");

long fileLength=fileLoad.length();

String length=String.valueOf(fileLength);

response.setHeader("Content_Length",length);

FileInputStream in=new FileInputStream(fileLoad);

int n=0;

while((n=in.read(b))!=-1)

{

bos.write(b,0,n);

}

bos.close();

}catch(Exception e){

out.println(e);

}

response.reset();

%>

..

e.getMessage()

Document : Downfile

Created on : -4-22, 17:55:43

Author : Administrator

--%>

显示下载

您已经上传的文件:

String path=request.getSession().getServletContext().getRealPath("/");

File file1=new File(path,"//upload");

String str[]=file1.list();

for(int i=0;i

String ss=str[i];

out.println("

"+ss+"下载");

}

%>

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。