📄 softdownaction.jsp~41~
字号:
<%@ page contentType="text/html; charset=GB2312" %>
<%@ page import="java.io.*"%>
<html>
<head>
<title>
软件园
</title>
<LINK href="css.css" type="text/css" rel="stylesheet">
</head>
<body bgcolor="#ffffff">
<%!
public String codeString(String s){
String str=s;
try{
byte b[]=str.getBytes("ISO-8859-1");
str=new String (b);
return str;
}catch(Exception e){
return "error";
}
}
%>
<%
String dbPath=request.getParameter("dbPath");
System.out.println(dbPath);
//String dbSoftware=request.getParameter("dbSoftware");
//System.out.println(dbSoftware);
String dbSoftware=dbPath.substring(dbPath.lastIndexOf('\\')+1);
System.out.println(dbSoftware);
if(dbPath==null) dbPath="";
if(!dbPath.equals("")){
//dbPath=codeString(dbPath);
//String dir="E:/Download/";
//dir=dir+dbSoftware;
try{ File file=new File(dbPath);
if(file.isFile()&&file.exists()){
System.out.print("FileExist");
OutputStream o=response.getOutputStream();
FileInputStream in=new FileInputStream(file);
byte b[]=new byte[1024];
response.setHeader("Content-disposition","attachment;filename="+dbSoftware);
response.setContentType("application/x-tar");
//response.setContentType("application/rar");
//response.setContentType("text/html;charset=gb2312");
//response.setContentType("application/*");
long filelength=file.length();
String length=String.valueOf(filelength);
response.setHeader("Content_Length",length);
int n=0;
while((n=in.read(b))!=-1){
o.write(b,0,n);
}
in.close();
o.close();
out.print("over");;
}
else{
out.print("文件不存在!");
}
}
catch(IOException e){
out.print("IOError!");
}
}
else{
//response.sendRedirect("downloadMain.jsp");
out.print("<script language=JavaScript>alert('没有此软件,请返回');");
out.print("javascript:history.go(-1);</script>");
}
%>
</body>
</html>
<%--
try { request.setCharacterEncoding("gb2312");
javax.naming.Context ic = new javax.naming.InitialContext();
Object obj = ic.lookup("softwareRemote");
software.softwareRemoteHome home = (software.softwareRemoteHome) javax.rmi.
PortableRemoteObject.narrow(obj,
software.softwareRemoteHome.class);
java.util.Collection c=home.getTypes();
java.util.Iterator i=c.iterator();
while(i.hasNext()){
String type=i.next().toString();
type=new String(type.getBytes("iso8859-1"),"gb2312");
out.println(type);
}} catch (Exception ex) {
ex.printStackTrace();
}
--%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -