JSP±¨±í´òÓ¡µÄÒ»ÖÖ¼òµ¥½â¾ö·½°¸
1. ÔÚWord»òExcelÖÐÖÆ×÷±¨±íµÄÑùʽ¡£
¡¡¡¡ExcelµÄÐиߺÍÁÐ¿íµ¥Î»ÎÞ·¨ÓÃmm»òcm±íʾ¡£
¡¡¡¡ÐèÒª¼ÆËã¡£ÔÚ1024*768Ï£¬1CMԼΪ38ÏñËØ¡£
¡¡¡¡ÒÔ´ËΪ»ù×¼£¬¿É¼ÆËã²¢¿ØÖƱ¨±íµÄÐÐÁÐλÖá£
¡¡¡¡2. ÔÚWordÖÐÉèÖÓ±í¸ñ——±êÌâÐÐÖظ´”¡£
¡¡¡¡ÔÚExcelÖÐÉèÖÓÎļþ——Ò³ÃæÉèÖ×—¹¤×÷±í——´òÓ¡±êÌ┡£
¡¡¡¡3. Áí´æΪÍøÒ³£¬¸Äºó׺Ãû“htm”Ϊ“jsp”¡£
¡¡¡¡4. Word±¨±íÎļþͷΪ£º
£¼%@page contentType="application/msword;charset=GBK" language="java"%£¾
¡¡¡¡Excel±¨±íÎļþͷΪ£º
£¼% @page contentType="application/vnd.ms-excel;charset=GBK" language="java"%£¾
¡¡¡¡5. ÔÚÎļþÍ·²¿·Ö¶¨Òå´òÓ¡²ÎÊý±äÁ¿ÈçÏ£¨ÒÔExcelΪÀý£©£º
£¼%
//ÐèÒª´òÓ¡µÄ¼Ç¼ÌõÊý
int PrintRowCount=RowCount;
//ÿҳ´òÓ¡µÄ¼Ç¼ÌõÊý
int PageRowCount=16;
//×îºóÒ»Ò³ÐèÒª´òÓ¡µÄ¿ÕÐеÄÊýÄ¿
int LoopNum=PageRowCount-PrintRowCount%PageRowCount;
//´òÓ¡ÇøÓòµÄ¸ß¶È£¬ÆäÖÐ2µÄÒâ˼ÊÇÿҳÐèÒªÖظ´µÄ±êÌâÐеÄÊýÄ¿
int PrintAreaHeight=(PrintRowCount%PageRowCount==0)?PrintRowCount+2:PrintRowCount+LoopNum+2;
%£¾
¡¡¡¡6. ÔÚ£¼style£¾£¼/style£¾ºó£¬¸Ä¶¯£¼!--[if gte mso 9]Ó룼![endif]--£¾±êÇ©ÖеÄXML±êÇ©ÄÚÈÝ£¬Ö÷ÒªÊÇÉèÖö¯Ì¬´òÓ¡ÇøÓò£¨ÒÔExcelΪÀý£©£º
£¼%
out.print(" ......
"£¼x:ExcelName£¾"+
"£¼x:Name£¾Print_Area£¼/x:Name£¾"+
"£¼x:SheetIndex£¾1£¼/x:SheetIndex£¾"+
"£¼x:Formula£¾=Sheet1!$A$1:$G$"+PrintAreaHeight+"£¼/x:Formula£¾"+
"£¼/x:ExcelName£¾"+
...... ");
%£¾
¡¡¡¡7. JSPÆäËû±àÂë¡£
¡¡¡¡ÏÂÃæÊÇÖ÷ÌåÑ»·´òÓ¡²¿·Ö£¨ÒÔExcelΪÀý£©£º
£¼%
for (int i=1;i£¼=PrintRowCount; i++)
{
out.print("£¼tr£¾"£¼td£¾"+i+"£¼/td£¾£¼/tr£¾"); //ÓÐÄÚÈÝ
}
if (LoopNum!=PageRowCount) //ÓпÕÐÐÔò´òÓ¡¿ÕÐв¹Æë×îÄ©Ò»Ò³
for (int j=1;j£¼=LoopNum; j++)
{
out.print("£¼tr£¾£¼td£¾¡¡£¼/td£¾£¼/tr£¾");//ÎÞÄÚÈÝ
}
%£¾
¡¡¡¡8. ²âÊÔ²¢¼ÌÐøÐ޸ġ£
ÎÄÕÂÀ´×Ô: ºÃϲ°®Ñ§Ï°Íø(http://www.haoxiai.net) ÍøÖ·£ºhttp://www.haoxiai.net/bianchengyuyan/jspjiaocheng/58877.html
Ïà¹ØÎĵµ£º
Ò»¡¢°²×°JDK ¡¡¡¡Ê×ÏÈÏÂÔØJDK 5.0£¨JDK 5.0µÄÏÂÔØÒ³ÃæΪ£ºhttp://java.sun.com/j2se/1.5.0/download.jsp£©£» È»ºóÔËÐÐJDK 5.0°²×°³ÌÐòjdk-1_5_0_06-windows-i586-p.exe£¬°²×°¹ý³ÌÖÐËùÓÐÑ¡Ïî±£³ÖĬÈÏ£»×îºóÅäÖÃJDKµÄ»·¾³±äÁ¿£ºÔÚ“ÎҵĵçÄÔ”ÉϵãÓÒ¼ü—>“ÊôÐÔ”—>“¸ß¼¶”& ......
Ëæ׿¼ÊõµÄÈÕÐÂÔÂÒì £¬JSPµÄм¼ÊõÒ²²ã³ö²»ÇΪÁË·½Ãæ´ó¼ÒµÄѧϰÓ빤×÷£¬ÏÂÃ潫¼òµ¥µÄ½éÉÜÒ»ÏÂJSP¼Ü¹¹¡¢JSP¿ª·¢¹¤¾ß¡¢Web·þÎñÆ÷¼°Æäîñȱµã¡£
JSP¼Ü¹¹£º
struts£º Struts¸úTomcat¡¢TurbineµÈÖî¶àApacheÏîÄ¿Ò»Ñù£¬ÊÇ¿ªÔ´Èí¼þ£¬ÕâÊÇËüµÄÒ»´óÓŵ㣬ʹ¿ª·¢ÕßÄܸüÉ ......
Ê÷½Úµã×éºÏÄ£ÐÍ
package cn.com.jsnh.model.catalog;
public class TreeModel {
private String node;
private CatalogModel model;
public String getNode() {
return node;
}
public void setNode(String node) {
this.node = node;
}
public CatalogModel getModel() {
return model;
}
public void setMo ......
ÒÔÇ°ÓÐÌáµ½¹ýÂÒÂëÎÊÌ⣬×î½üÔÚʹÓÃwindow.openʱÓÖ³öÏÖ´ËÀàÎÊÌ⣬ÏÖ½â¾öÈçÏ£º
1£ºÊ¹ÓÃencodeURIComponentº¯Êý¶Ô²ÎÊý½øÐд¦Àí£¬ÀýÈ磺window.open("html.jsp?name=" + encodeUrlComponent(value)));
2£ºÐÞ¸Ätomcat·þÎñÆ÷µÄserver.xmlÎļþÌí¼Ó£ºuseBodyEncodingForURI="true"»òÕß
URIEncoding=" ......
JSP¹²ÓÐÒÔÏÂ6ÖÖ»ù±¾¶¯×÷£º
1.jsp:include£ºÔÚÒ³Ãæ±»ÇëÇóµÄʱºòÒýÈëÒ»¸öÎļþ¡£
2.jsp:useBean£ºÑ°ÕÒ»òÕßʵÀý»¯Ò»¸öJavaBean¡£
3.jsp:setProperty£ºÉèÖÃJavaBeanµÄÊôÐÔ¡£
4.jsp:getProperty£ºÊä³öij¸öJavaBeanµÄÊôÐÔ¡£
5.jsp:forward£º°ÑÇëÇóתµ½ ......