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

java excel ÎļþÏÂÔØ

ʹÓÃservletÀ´ÏÂÔØÎļþ£¬ÆäÔ­Àí·Ç³£¼òµ¥£¬Ö»ÒªµÃµ½ÎļþµÄÊäÈëÁ÷£¨»òÏàÓ¦×Ö½Ú£©£¬È»ºóдÊä³öÁ÷¼´¿É¡£ÏÖ¾ÍÆäÖеļ¸¸öϸ½ÚÎÊÌâÕ¹¿ª£º
1. MIMEÀàÐ͵ÄÉèÖãº
Web ä¯ÀÀÆ÷ʹÓà MIME ÀàÐÍÀ´Ê¶±ð·Ç HTML Îĵµ£¬²¢¾ö¶¨ÈçºÎÏÔʾ¸ÃÎĵµÄÚµÄÊý¾Ý¡£
ÀýÈçEXCELÎļþµÄ MIME ÀàÐÍÊÇ "application/vnd.ms-excel "¡£ÒªÓÃservlet À´´ò¿ªÒ»¸ö EXCEL Îĵµ£¬ÐèÒª½« response ¶ÔÏóÖÐ header µÄ contentType ÉèÖóɓapplication/vnd.ms-excel ”¡£
response.setContentType(contentType);
2. Content disposition
HTTP response headerÖеÄcontent-disposition ÔÊÐí servlet Ö¸¶¨Îĵµ±íʾµÄÐÅÏ¢¡£Ê¹ÓÃÕâÖÖheader £¬Äã¾Í¿ÉÒÔ½«ÎĵµÖ¸¶¨³Éµ¥¶À´ò¿ª£¨¶ø²»ÊÇÔÚä¯ÀÀÆ÷Öдò¿ª£©£¬»¹¿ÉÒÔ¸ù¾ÝÓû§µÄ²Ù×÷À´ÏÔʾ¡£
Èç¹ûÓû§Òª±£´æÎĵµ£¬Ä㻹¿ÉÒÔΪ¸ÃÎĵµ½¨ÒéÒ»¸öÎļþÃû¡£Õâ¸ö½¨ÒéÃû³Æ»á³öÏÖÔÚ Save As ¶Ô»°¿òµÄ“ÎļþÃû”À¸ÖС£Èç¹ûûÓÐÖ¸¶¨£¬Ôò¶Ô»°¿òÖоͻá³öÏÖ servlet µÄÃû×Ö¡£
servlet ÖУ¬½« header ÉèÖóÉÏÂÃæÕâÑù£º
response.setHeader("Content-disposition","attachment;filename="+ "Example.xls" );
response.setHeader("Content-Disposition", "inline; filename="fliename)
µã»÷´ò¿ª»áÔÚieÖдò¿ª¡£
ÐèҪ˵Ã÷µÄÓÐÈýµã£º
Ø ÖÐÎÄÎļþÃûÐèÒª½øÐÐiso8859-1תÂë·½¿ÉÕýÈ·ÏÔʾ£º
fileName = new String(fileName.getBytes("GBK"),"iso8859-1");
Ø ´«µÝµÄÎļþÃû£¬ÐèÒª°üº¬ºó׺Ãû£¨Èç¹û´ËÎļþÓкó׺Ãû£©£¬·ñÔò¶ªÊ§ÎļþµÄÊôÐÔ£¬¶ø²»ÄÜ×ÔÐÐÑ¡ÔñÏà¹Ø³ÌÐò´ò¿ª¡£
Ø ÓÐÏÂÔØǰѯÎÊ£¨ÊÇ´ò¿ªÎļþ»¹ÊDZ£´æµ½¼ÆËã»ú£©ºÍͨ¹ýIEä¯ÀÀÆ÷Ö±½ÓÑ¡ÔñÏà¹ØÓ¦ÓóÌÐò²å¼þ´ò¿ªÁ½ÖÖ·½Ê½£¬Ç°ÕßÈçÉÏ´úÂëËùʾ£¬ºóÕßÈçÏ£º
response.setHeader("Content-disposition","filename="+ "Example.xls" );
3. ÔÚÑо¿ÎļþµÄÉÏ´«¼°ÏÂÔعý³ÌÖУ¬Óм¸µãÌå»á
³ÌÐòµÄI/O²Ù×÷ÍùÍùÊÇÐÔÄܵÄÆ¿¾±ËùÔÚ£¬java io¶¨ÒåÁËÁ½¸ö»ù±¾µÄ³éÏóÀà:InputStreamºÍOutputStream,¶ÔÓÚ²»Í¬µÄÊý¾ÝÀàÐͱÈÈç´ÅÅÌ£¬ÍøÂçÓÖÌṩÁ˲»Í¬µÄʵÏÖ£¬java.ioÒ²ÌṩÁËһЩ»º³åÁ÷(BufferedStream)£¬Ê¹Ó²ÅÌ¿ÉÒԺܿìµÄ¶Áдһ´ó¿éµÄÊý¾Ý, ¶øJava»ù±¾µÄI/OÀàÒ»´ÎÖ»ÄܶÁдһ¸ö×Ö½Ú,µ«»º³åÁ÷(BufferedStream)¿ÉÒÔÒ»´Î¶ÁдһÅúÊý¾Ý£¬,»º³åÁ÷(Buffered Stream)´ó´óÌá¸ßÁËI/OµÄÐÔÄÜ¡£ËùÒÔ:
ØС¿éС¿éµÄ¶ÁдÊý¾Ý»á·Ç³£Âý,Òò´Ë,¾¡Á¿´ó¿éµÄ¶ÁдÊý¾Ý
ØʹÓÃBufferedInputStreamº


Ïà¹ØÎĵµ£º

¡¾×ª¡¿JAVA RMI ¿ìËÙÈëÃÅʵÀý

http://damies.javaeye.com/blog/51778
¹Ø¼ü×Ö: RMI
JAVA RMI ¿ìËÙÈëÃÅʵÀý
±¾ÊµÀýΪ²Î¿¼¶àƪÎÄÕÂд¾Í¶ø³É£¬ÍøÉϼ°ÊéÉϸ÷ÀàÎÄÕ½éÉÜÈçºÎʹÓÃRMIÓжàÖÖʵÀý¿É²Î¿¼£¬Æ©ÈçÓУº
1. ÓÃÃüÁîrmiregistryÆô¶¯RMI×¢²á·þÎñµÄ
2. ͬʱ´´½¨´æ¸ù(stub)ºÍ¹Ç¼Ü(skeleton)µÄ
3. Ö»´´½¨´æ¸ùÀàµÄµÄ(jdk1.2ÒÔºó°æ±¾)
4. ͨ¹ýRemoteRefº ......

³ÎÇåjavaÓïÑÔ½Ó¿ÚÓë¼Ì³ÐµÄ±¾ÖÊ

OOµÄ¾«Ë裬ÎÒÒÔΪ£¬ÊǶԶÔÏóµÄ³éÏó£¬×îÄÜÌåÏÖÕâÒ»µãµÄ¾ÍÊǽӿڡ£ÎªÊ²Ã´ÎÒÃÇÌÖÂÛÉè¼Æģʽ¶¼Ö»Õë¶Ô¾ß±¸Á˳éÏóÄÜÁ¦µÄÓïÑÔ£¨±ÈÈçc++¡¢java¡¢c#µÈ£©£¬¾ÍÊÇÒòΪÉè¼ÆģʽËùÑо¿µÄ£¬Êµ¼ÊÉϾÍÊÇÈçºÎºÏÀíµÄÈ¥³éÏó¡££¨cowboyµÄÃûÑÔÊÇ"³éÏó¾ÍÊdzéÈ¥ÏñµÄ²¿·Ö"£¬¿´ËƵ÷Ù©£¬ÊµÄËÖÁÀí£©¡£
Éè¼ÆģʽÖÐ×î»ù´¡µÄÊǹ¤³§Ä£Ê½£¨Factory£©£¬ÔÚÎÒ×î ......

JavaÓëXMLÁªºÏ±à³ÌÖ®SAXƪ

ת×Ôhttp://www0.ccidnet.com/tech/guide/2001/10/08/58_3392.html
SAX¸ÅÄî
SAXÊÇSimple API for XMLµÄËõд£¬Ëü²¢²»ÊÇÓÉW3C¹Ù·½ËùÌá³öµÄ±ê×¼£¬¿ÉÒÔ˵ÊÇ“Ãñ¼ä”µÄÊÂʵ±ê×¼¡£Êµ¼ÊÉÏ£¬ËüÊÇÒ»ÖÖÉçÇøÐÔÖʵÄÌÖÂÛ²úÎï¡£ËäÈ»Èç´Ë£¬ÔÚXMLÖжÔSAXµÄÓ¦ÓÃË¿ºÁ²»±ÈDOMÉÙ£¬¼¸ºõËùÓеÄXML½âÎöÆ÷¶¼»áÖ§³ÖËü¡£
ÓëDOM±È½Ï¶øÑÔ ......

java»ñÈ¡URLµØÖ·

     String   url=request.getScheme()+"://";  
        url+=request.getHeader("host");  
        url+=request.getRequestURI();  
       ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ