Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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


Ïà¹ØÎĵµ£º

weblogicÓëwebsphereµÄ²îÒì Ö® jspÖеÄ×¢ÊÍÎÊÌâ

    ½ñÌì²âÊÔÈËÔ±¸øÎÒÌáÁËÒ»¸öbug£¬ËµÎÒ¿ª·¢µÄÄ£¿é±¨¿ò¼ÜµÄjs´íÎ󣬵±Ê±Ò»Ìý¾ÍãÂÁË£¬ÎÒ±¾µØ²âÊÔÍêȫûÎÊÌ⣬ÔõôÉÏÁË·þÎñÆ÷»á³öÏÖÕâ¸öÎÊÌâÄØ£¿
    ÓÚÊÇÎÒÈ¥·þÎñÆ÷ÉϲâÁËÒ»ÏÂ×Ô¼ºÐ´µÄÄǸöÄ£¿é£¬½á¹û±¨µÄ´íÎ󻹺ͲâÊÔÈËÔ±Ìá¸øÎҵĴíÎó²»Ò»Ö£¬ÔÓ»ØÊ£¿ÓÚÊÇÎÒÓÖÕÒµ½Ò»ÃûͬÊ£¬ÈÃËû°ïÎÒ²âһϣ ......

JSPÖÐÊä³öCSVÎļþ

<%@page import="com.opensymphony.xwork2.util.ValueStack"%><%
    ValueStack vs = (ValueStack)request.getAttribute("struts.valueStack");  
    String aa = (String)vs.findValue("downloadContent");
    response. ......

Ëѹ·Ë«ºËµÄJSP sessionÎÊÌâ

Ëѹ·Ë«ºËä¯ÀÀÆ÷³öÀ´Ö®ºó£¬ÎÒ¾ÍÓÃËüÀ´µ÷ÊÔÒ³Ã棬°´Ò»¸ö°´Å¥¿ÉÒÔÇл»Á½ÖÖä¯ÀÀÆ÷ÒÔ¹Û²ìÍøҳЧ¹û£¬»¹ÊDZȽϷ½±ãµÄ£¬µ«ÊÇ×î½ü·¢ÏÖËѹ·µÄJSP sessionòËƳöÏÖÎÊÌâ¡£»¹ÔÚ²âÊÔÖУ¬×î½üÒ»Á½Ìì»áд³öÒ»¸ö±È½ÏÏêϸµÄ²âÊÔ±¨¸æ¡£°¥£¬ÄѵÀÊÇÎÒµÄsessionдµÄÓÐÎÊÌ⣿ÔõôÔÚÍøÉÏËѲ»µ½ÀàËƵĶ«Î÷... ......

jspµÄ×Ö·ûÎÊÌâ

tomcat ĬÈÏʹÓõÄ×Ö·û¼¯ÊÇISO-8859-1£¬²»Ö§³ÖÖÐÎÄ×Ö·û£¬ËùÒÔÔÚÏÖʵÖÐÎÄʱÐèҪת»»×Ö·ûºÍÉèÖÃ×Ö·û¼¯¡£
server.mxl¸ÄΪ<Connector port="8080" protocol="HTTP/1.1" maxThreads="150" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8" /> £¬Ìí¼Ó´úÂëת»»×Ö·ûString.getBytes("ISO-8859-1"),"UTF-8 ......

JSPÖÐerrorPageµÄÎÊÌâ

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