jspÖÐtableµ¼³ÉexclÎļþ
ÏîÄ¿ÒªÇ󽫺ǫ́Êý¾Ý½øÐÐÏÔʾ£¨ÏÔʾҪÇ󲿷ÖÄÚÈݽøÐÐÁÐÏîºÏ²¢£©£¬ÔÚ¶ÔÏÔʾµÄÊý¾Ý½øÐе¼³ö³Éexcel
ʵÏÖ¹ý³Ì
1¡¢²éѯºÍµ¼³öµÄjspÒ³Ãæ ¹Ø¼ü´úÂë
<script language=javascript>
function exportExcel(){
/****ʵÏÖ·½·¨Ò»
<%-- var curTbl = document.getElementById("techQueryTab"); --%>
<%-- var oXL = new ActiveXObject("Excel.Application"); --%>
<%-- //´´½¨AX¶ÔÏóexcel --%>
<%-- var oWB = oXL.Workbooks.Add(); --%>
<%-- //»ñÈ¡workbook¶ÔÏó --%>
<%-- var oSheet = oWB.ActiveSheet; --%>
<%-- //¼¤»îµ±Ç°sheet --%>
<%-- var sel = document.body.createTextRange(); --%>
<%-- sel.moveToElementText(curTbl); --%>
<%-- //°Ñ±í¸ñÖеÄÄÚÈÝÒƵ½TextRangeÖÐ --%>
<%-- sel.select(); --%>
<%-- //È«Ñ¡TextRangeÖÐÄÚÈÝ --%>
<%-- sel.execCommand("Copy"); --%>
<%-- //¸´ÖÆTextRangeÖÐÄÚÈÝ --%>
<%-- oSheet.Paste(); --%>
<%-- //Õ³Ìùµ½»î¶¯µÄEXCELÖÐ --%>
<%-- oXL.Visible = true; --%>
<%-- //ÉèÖÃexcel¿É¼ûÊôÐÔ --%>
***ʵÏÖ·½·¨Ò»*/
//***ʵÏÖ·½·¨¶þ ͨ¹ýform½øÐÐÌá½»ÖÁhtml2excel.jsp
var myform=document.createElement('form');
myform.action='common/html2excel.jsp';
myform.method='post';
myform.target='_blank';
var html=document.createElement('<input type="hidden" name="html">');
html.value=document.getElementById('table-container').innerHTML;
myform.appendChild(html);
document.appendChild(myform);
myform.submit();
}
//ʵÏÖ·½·¨¶þ½áβ
</script>
¡£¡£¡£
//¹¹Ôìtable²¿·Ö
<div id='table-container'>
<table id="techQueryTab" width="100%" borde
Ïà¹ØÎĵµ£º
//ѧϰ±Ê¼Ç, ¿ÉÄÜÓÐЩµØ·½Àí½âÓÐÎó, »á±í´ï²»Çå³þ
v512_servlet+jsp
01 ÔÚÐÞ¸ÄÍêCookieºó,Ò»¶¨Òª¼ÓÉÏresponse.addCookie(c);
CookieÖÐÖ»Äܱ£´æ×Öĸ»òÊý×ÖÐÅÏ¢;
02 req.getSession()Óëreq.getSession(boolean create)
ÎÞ²ÎÊýµÄ == ÓвÎÊýµÄ²ÎÊýÎ ......
title: JSP·ÖÒ³¼¼ÊõʵÏÖ
summary:ʹÓù¤¾ßÀàʵÏÖͨÓ÷ÖÒ³´¦Àí
author: evan_zhao
email: evan_zhao@hotmail.com
¡¡¡¡Ä¿Ç°±È½Ï¹ã·ºÊ¹ÓõķÖÒ³·½Ê½Êǽ«²éѯ½á¹û»º´æÔÚHttpSession»òÓÐ״̬beanÖУ¬·Ò³µÄʱºò´Ó»º´æÖÐÈ¡³öÒ»Ò³Êý¾ÝÏÔʾ¡£ÕâÖÖ·½·¨ÓÐÁ½¸öÖ÷ÒªµÄȱµã£ºÒ»ÊÇÓû§¿ÉÄÜ¿´µ½µÄÊǹýÆÚÊý¾Ý£»¶þÊÇÈç¹ûÊ ......
JSPÖеÄÌøת£º
(1). forward()·½·¨
ʹÓõ½javax.servlet.RequestDispatcherÀà
RequestDispatcher rd = getServletContext().getRequestDispatcher("url");
rd.forward(requestVar,requestVar); //´«µÝservletµÄÈë¿Ú²ÎÊý
/*forwardº ......
ÔÚMyEclipseÖпª·¢WEBÓ¦ÓÃʱ¾³£Òª´´½¨JSPÎļþ£¬µ«ÊÇÿ´ÎMyEclipse¶¼»áÓÃĬÈϵÄMyEclipse Visual JSP Designer£¬´ò¿ªËٶȷdz£Âý£¬¶øÇÒ»ù±¾ÉÏÒ²Óò»µ½Õâ¸ö¿ÉÊÓ»¯µÄJSP±à¼Æ÷£¬¶à°ë¶¼ÊÇʹÓÃMyEclipse JSP Editor£¬ËùÒÔ£¬ÓбØÒª°ÑĬÈϵÄJSPÎļþ±à¼Æ÷¸Ä³ÉMyEclipse JSP Editor£¬·½±ãʹÓã¬Ò²¿É ......
×î½üÔÚѧJAVA£¬Á·Ï°µÄʱºòÓöµ½¸öÎÊÌ⣬Çë´ó¼Ò°ïæ¿´¿´……
Ö÷ÒªÎÊÌâÊÇ£¬ÔÚJSPÖÐûÓа취µ¼ÈëÎÒÏëÓõÄÀ࣬Ã÷Ã÷µ¼ÈëÁË°ü£¬È´±¨£ºMyDAO cannot be resolved to a type
JSP´úÂ룺
<%@ page contentType="text/html;charset=GBK"%>
<%@ page import="java.util.Date"%>
<%@ page import="java.t ......