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

СӦÓ×—jspµ¼³öExcel¼òµ¥±¨±í

½ñÌì¿´µ½Á˹«Ë¾ÒÔÓеÄÏîÄ¿ÀïÃæÓÐÖ±½Óͨ¹ýjsp£¨table£©µ¼³öΪexcel±¨±íµÄÓ¦Ó㬸оõºÜÐÂÆ棬ÒÔÓÐ×öµ¼³öexcel¶¼»áÓÃjava´úÂëд£¬Óõ½×¨ÃŵÄÀà¿â£¬²Ù×÷excelÄ£°å£¬ºÜ¸´ÔÓ£¬ÓÃÕâ¸ö·½·¨£¬¿ÉÄܵõ½µÄ±í¸ñûÓÐÄÇô¾«È·£¬µ«¼òµ¥¸ßЧ£¬Ó¦¸ÃÊÇÒ»¸ö²»´íµÄÓ¦Óá£ÏÂÃæµÄÍøÉϱðµÄͬȥµÄһƪÎÄÕ£¬ÕâÀïÕ³Á˹ýÀ´£¬ºÃ¼Çס£¬ÌØ´ËÉùÃ÷¡£
JSPÓ¦Óõ¼³öExcel±¨±íµÄ¼òµ¥ÊµÏÖÒÔ¼°ÖÐÎÄÂÒÂë³¹µ×½â¾ö£¨HTML)
WebÓ¦Óõ¼³öExcel±¨±íµÄ¼òµ¥ÊµÏÖ£¨HTML£©
ÔÚWebÓ¦ÓÃÖУ¬ºÜ¶àÊý¾Ý¾­³£Òªµ¼³ö³ÉExcelÎĵµ¡£ÓÃרÃŵÄÉú³ÉÕæÕýµÄExcelÎĵµµÄ·½Ê½±È½Ï¸´ÔÓ£¬²»Ì«ºÃÓá£ËùÒÔ¾­³£ÓÃÒ»ÖÖ¼òµ¥µÄ·½Ê½À´ÊµÏÖ£¬¼´½«±¨±í±£´æΪHTML¸ñʽ£¬È»ºóÓÃExcel´ò¿ª¡£
ʵÏÖ·½Ê½£º
µÚÒ»²½,ÓÃJSPʵÏÖHTML°æ±¾µÄ±¨±í
µÚ¶þ²½,ÔÚ¸ÃJSPÒ³ÃæÍ·²¿ÉèÖÃresponseµÄContentTypeΪExcel¸ñʽ
ÒýÓÃ
<% response.setContentType("application/vnd.ms-excel;charset=GBK"); %>
ÖÐÎÄÎÊÌ⣺
²é¿´Ô´´úÂëʱ·¢ÏÖJSPÎļþÖÐдËÀµÄÖÐÎÄΪÂÒÂ룬ÔòÔÚJSPÎļþÍ·²¿Ìí¼ÓÒ»ÐÐ
ÒýÓÃ
<%@ page contentType="text/html; charset=gb2312" %>
²é¿´Ô´´úÂëʱ·¢ÏÖÎÄ×ÖΪÖÐÎÄ£¬µ«ÊÇÓÃExcel´ò¿ªÎªÂÒÂëÔòÔÚ<html>Óë<head>ÖмÓÈë
ÒýÓÃ
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
ÓÃServletʵÏÖÒ²ÊÇÀàËƵĴ¦Àí·½·¨¡£
Java´úÂë
<%@ page contentType="text/html; charset=GBK" %>   
<% response.setContentType("application/vnd.ms-excel;charset=GBK"); %>   
<HTML>   
<meta http-equiv="Content-Type" content="text/html; charset=GBK">   
<head><title>Test</title></head>   
<body>   
<TABLE borderColor=#111111 cellSpacing=0 cellPadding=2 width=1200 align=center border=1>   
<TR>   
<TD align=middle width="10%" height=20 rowSpan=2>ÏîÄ¿ </TD>   
<TD align=middle width="2%" height=20 rowSpan=2>¼ÆÁ¿µ¥Î» </TD>   
<TD align=middle width="4%" height=20>ÂúÆÚÅ⸶ÂÊ&nbs


Ïà¹ØÎĵµ£º

JSP×¢ÊÍ

½ñÌìÔÚµ÷ÊÔ´úÂëʱ£¬·¢ÏÖÒ»¶ÎдÔÚjsp¶ËµÄjava´úÂëÔõô±àÒ룬ÉèÖöϵ㶼²»»áÔڶϵ㴦ͣÁô¡£°Ù˼²»µÃÆä½â£¬ÔÚͬʵİïÖúÏ£¬·¢ÏÖÊÇ´úÂë×¢ÊÍÓÐÎÊÌâ¡£
      Ô­´úÂ룺
            <!-- <jsp:forward page="/hello/Welcome.do"/> - ......

JSPÖÐincludeÖ¸ÁîºÍincludeÐÐΪÇø±ð

 ÎÒÃǶ¼ÖªµÀÔÚjspÖÐincludeÓÐÁ½ÖÖÐÎʽ,·Ö±ðÊÇ
<%@ include file=” ”%>
<jsp:include page=” ” flush=”true”/>
    Ç°ÕßÊÇÖ¸ÁîÔªËØ¡¢ºóÕßÊÇÐÐΪԪËØ¡£¾ßÌåËüÃǽ«Ôںδ¦Óã¿ÈçºÎÓü°ËüÃÇÓÐʲôÇø±ð£¿ÕâÓ¦¸ÃÊǺܶàÈË¿´ ......

jspºÍActionÖÐBase64±àÂëת»»

jspÖÐÓÃjavascript½«ÖÐÎÄBase64תÂë, ActionÖÐÔÙÓÃBase64½âÂë
javascriptÖÐʹÓÃwebtoolkit.base64.js,ÏÂÔصØÖ·http://www.webtoolkit.info/djs/webtoolkit.base64.js
Ïà¹Ø½éÉÜ http://www.webtoolkit.info/javascript-base64.html
/**
*
*  Base64 encode / decode
*  http://www.webtoolkit.info/
*
**/ ......

JSPÖÐerrorPageµÄÎÊÌâ

           µ±ÔÚJSPµÄpageÖ¸ÁîÖÐÉèÖÃerrorPage="url"¾Í¿ÉÒÔÉèÖô¦ÀíÒ쳣ʼþµÄJSPÎļþ¡£Èç¿ÉÒÔÕâÑùд£º
                <%@ page errorPage="error.jsp" %>
           ÕâÑùµÄ»°£¬µ±Ò³ÃæÖгöÏÖÒì³£µÄÊ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ