<a href="urfile">click here to download</a>
解决方案 »
- session 登录问题
- 讨论Java web开发中用到的各种小技术,或者说模块技术吧!做过总计,讨论讨论到底那个好用些。。。
- 一个jsp 自动登陆bug
- jsp vbscript调用webservice问题
- 有关LabelValueBean的一点问题
- 关于session和cookie的一点疑问
- 急!!读取图片并保存到本地的问题
- 写好的jsp文件无法打开
- 关于 Servlet编译不得不说的一个要大家注意的地方
- 我在WIN2000SERVER中安装了JRUN,现在可以在LOCALHOST:8000中打开JRUN,但是我编写了一个lei.jsp文件,却不知道怎么打开,每次输入http://localhost:8000/lei.jsp都会出现下面的提示。
- 终于连上Oracle,请教高手有没有用javabean实现jdbc连接的例子学习学习?
- 关于javascript里的alert
int blockSize) throws IOException, ServletException{
if(sourceFilePathName == null)
throw new IllegalArgumentException("File '"+sourceFilePathName+"' not found.");
if(sourceFilePathName.equals(""))
throw new IllegalArgumentException("File '"+sourceFilePathName+"' not found.");
if(isVirtual(sourceFilePathName))
sourceFilePathName = m_application.getRealPath(sourceFilePathName);
File file = new File(sourceFilePathName);
if(!file.exists())
throw new IllegalArgumentException("File '"+sourceFilePathName+"' not found."); FileInputStream fileIn = new FileInputStream(file);
long fileLen = file.length();
int readBytes = 0;
int totalRead = 0;
byte b[] = new byte[blockSize];
if(contentType == null)
m_response.setContentType(downContentType);
else
if(contentType.length() == 0)
m_response.setContentType(downContentType);
else
m_response.setContentType(contentType);
m_response.setContentLength((int)fileLen); m_contentDisposition = m_contentDisposition != null ? m_contentDisposition : "attachment;";
if(destFileName == null)
m_response.setHeader("Content-Disposition", m_contentDisposition+" filename="+getFileName(sourceFilePathName));
else
if(destFileName.length() == 0)
m_response.setHeader("Content-Disposition", m_contentDisposition);
else
m_response.setHeader("Content-Disposition", m_contentDisposition+" filename="+destFileName);
while((long)totalRead < fileLen){
readBytes = fileIn.read(b, 0, blockSize);
totalRead += readBytes;
m_response.getOutputStream().write(b, 0, readBytes);
}
fileIn.close();
}
txt,doc,...就得用后一种方法啦。