大神,就是那个jsp文件下载问题,现在点击是打开文件,而不是下载,需要怎么改?
很急看到帮忙下谢谢<%@pagelanguage="java"contentType="text/html;charset=gb2312"%><%@pageimport=...
很急 看到帮忙下 谢谢
<%@ page language="java" contentType="text/html;charset=gb2312"%>
<%@ page import="cn.*"%>
<%@ page import="java.io.File"%>
<%@ page import="java.util.Vector"%>
<%
String dir1 = getServletContext().getRealPath("/upload");
//String dir1 = application.getRealPath("/upload");
File file1 = new File(dir1);
System.out.println(file1.list().length);
for (int i = 0; i < file1.list().length; i++) {
%>
<a href="<%=request.getContextPath()%>/upload/<%=file1.list()[i]%>"><%=file1.list()[i]%></a>
<%
out.println("<br>");
}
%> 展开
<%@ page language="java" contentType="text/html;charset=gb2312"%>
<%@ page import="cn.*"%>
<%@ page import="java.io.File"%>
<%@ page import="java.util.Vector"%>
<%
String dir1 = getServletContext().getRealPath("/upload");
//String dir1 = application.getRealPath("/upload");
File file1 = new File(dir1);
System.out.println(file1.list().length);
for (int i = 0; i < file1.list().length; i++) {
%>
<a href="<%=request.getContextPath()%>/upload/<%=file1.list()[i]%>"><%=file1.list()[i]%></a>
<%
out.println("<br>");
}
%> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询