android library projects cannot be launched
properties 在android選項中將 is library中將前面的勾去了
package com.shxt.controller;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.net.URLEncoder;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class DownLoadServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
this.doPost(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("application/x-msdownload");
PrintWriter out = response.getWriter();
response.reset();// 可以加也可以不加
response.setContentType("application/x-download");
String filedownload = request.getRealPath("/images")
+ "\\02_開發第一個無狀態會話bean.avi";// "想辦法找到要提供下載的文件的物理路徑+文件名";
System.out.print(filedownload);
String filedisplay = "okokok.avi";// "給用戶提供的下載文件名";
filedisplay = URLEncoder.encode(filedisplay, "UTF-8");
response.addHeader("Content-Disposition", "attachment;filename="
+ filedisplay);
OutputStream outp = null;
FileInputStream in = null;
try {
outp = response.getOutputStream();
// 你可以指定你的ftp輸入流
in = new FileInputStream(new File(filedownload));
byte[] b = new byte[1024];
int i = 0;
while ((i = in.read(b)) > 0) {
outp.write(b, 0, i);
}
outp.flush();
} catch (Exception e) {
System.out.println("Error!");
e.printStackTrace();
} finally {
if (in != null) {
in.close();
in = null;
}
if (outp != null) {
outp.close();
outp = null;
}
//out.clear();
//out = pageContext.pushBody();
}
}
}
摘要: 轉自:轉載請標明出處:http://blog.csdn.net/anyoneking/archive/2008/05/23/2472145.aspx1.回傳一個普通的String字符串.2.回傳一個組織好的Javascript字符串.3.回傳一個Json對象.(需要引入json.jar)4.回傳一個XML對象.基本實現如下:其中測試頁面為:
<%@page language="j...
閱讀全文
經過試驗后發現HTML錨點在JSP中并不兼容。兩者表示錨點的方法有所不同
HTML錨點
<a href="#1">goto1</a>
.
.
.
.
<a name="1">111</a>
這樣從goto1可以定位到111
JSP錨點
<a href="javascript:void(0)" onclick="document.getElementById('1').scrollIntoView();">goto1</a>
。
。
。
<a id="1">1111</a>
HTML to PDF conversion for your website or application
http://www.htm2pdf.co.uk/
通過js事件獲取元素中的屬性值
<div id="c-title1" onclick="openAndClose(this)" value="content1" >報告概覽</div>
function openAndClose(myelement) {
alert(myelement.attributes["value"].value );
}