Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

JAVA excel

<%    
 response.setContentType("application/vnd.ms-excel;charset=utf-8");
 String  reportname = (String)request.getAttribute("reportname");
 String  reportFileName=java.net.URLEncoder.encode(reportname, "UTF-8");
 String  filenamedisplay =reportFileName+".xls";
 response.addHeader("Content-Disposition","attachment;filename=" + filenamedisplay);//Ôö¼ÓĬÈϱ£´æÎļþÃû 
 String  userid = (String)request.getAttribute("_fm_userid"); 
 int index=0;
%>
<html>
  <head>
    <title><%=reportname%>²é詢Áбí</title>    
 <meta http-equiv="pragma" content="no-cache">
 <meta http-equiv="cache-control" content="no-cache">
 <meta http-equiv="expires" content="0">   
 <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
 <meta http-equiv="description" content="This is my page"> 
  </head>
<%
File file=new File("G:/Eclipse.pdf");//ÎļþÀàÐÍ ¿ÉÒÔΪPDF XLS DOC
FileInputStream in=new FileInputStream(file);
byte [] b=new byte[1024];
response.setContentType("application/pdf;charset=GB2312");//application/pdf  /msxml(excel)  /msword
//response.setHeader("Content-Disposition",   "attachment;   filename=9602.pdf");//ÏÂÔØ
int len;
while((len=in.read(b))>0)   
      response.getOutputStream().write(b,0,len);
%>
///////////////////////////////////////////////////////////////////
ÔÚweb.xmlÖмÓÈë
  <mime-mapping>
    <extension>doc</extension>
    <mime-type>application/msword</mime-type>
  </mime-mapping>
  <mime-mapping>
    <extension>xls</extension>
    <mime-type>application/msexcel&l


Ïà¹ØÎĵµ£º

javaÁ¬½Ó³£¼ûÊý¾Ý¿âµÄÁ¬½Ó×Ö·û´®

javaÁ¬½Ó³£¼ûÊý¾Ý¿âµÄÁ¬½Ó×Ö·û´®
1. MySQL(http://www.mysql.com)mm.mysql-2.0.2-bin.jar ;
Class.forName( "org.gjt.mm.mysql.Driver" );
cn = DriverManager.getConnection( "jdbc:mysql://MyDbComputerNameOrIP:3306/myDatabaseName", sUsr, sPwd );
2. PostgreSQL(http://www.de.postgresql.org)pgjdbc2.jar ;
C ......

java¼ÆËãÁ½ÈÕÆÚ¼ä¸ôÌìÊý

package com.color.program;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
public class CompareTime {
public static void main(String[] args){
String t1 = "2008-05-09";
String t2 = "20 ......

ʲôÊÇjava¶ÔÏóµÄÇ¿¡¢Èí¡¢ÈõºÍÐéÒýÓÃ

±¾ÎĽéÉܶÔÏóµÄÇ¿¡¢Èí¡¢ÈõºÍÐéÒýÓõĸÅÄî¡¢Ó¦Óü°ÆäÔÚUMLÖеıíʾ¡£
1£®¶ÔÏóµÄÇ¿¡¢Èí¡¢ÈõºÍÐéÒýÓÃ
   ÔÚJDK 1.2ÒÔǰµÄ°æ±¾ÖУ¬ÈôÒ»¸ö¶ÔÏó²»±»ÈκαäÁ¿ÒýÓã¬ÄÇô³ÌÐò¾ÍÎÞ·¨ÔÙʹÓÃÕâ¸ö¶ÔÏó¡£Ò²¾ÍÊÇ˵£¬Ö»ÓжÔÏó´¦ÓÚ¿É´¥¼°£¨reachable£©×´Ì¬£¬³ÌÐò²ÅÄÜʹÓÃËü¡£´ÓJDK 1.2°æ±¾¿ªÊ¼£¬°Ñ¶ÔÏóµÄÒýÓ÷ÖΪ4ÖÖ¼¶±ð£¬´Ó¶øÊ ......

javaÓÃCommons fileupload ÎļþµÄÉÏ´«


»ùÓÚ±íµ¥µÄÎļþÉÏ´«
Èç¹ûÔÚ±íµ¥ÖÐʹÓÃ±íµ¥ÔªËØ <input type=“file”
/>£¬ä¯ÀÀÆ÷ÔÚ½âÎö±íµ¥Ê±£¬»á×Ô¶¯Éú³ÉÒ»¸öÊäÈë¿òºÍÒ»¸ö°´Å¥£¬ÊäÈë¿ò¿É¹©Óû§Ìîд±¾µØÎļþµÄÎļþÃûºÍ·¾¶Ãû£¬°´Å¥¿ÉÒÔÈÃä¯ÀÀÆ÷´ò¿ªÒ»¸öÎļþÑ¡Ôñ¿ò¹©
Óû§Ñ¡ÔñÎļþ£º
µ±±íµ¥ÐèÒªÉÏ´«Îļþʱ£¬ÐèÖ¸¶¨±íµ¥ enctype µÄֵΪ multipart/fo ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ