jspÉú³ÉExcel±¨±íµÄ·½·¨
Excel±¨±íµÄ·½·¨£¬Ò»¸ö¹ý춼òµ¥£¬Ò»¸öÖ»ÄÜÓÃì¶windowƽ̨(ÒòΪʹÓÃjdbc-odbc bridge)£¬ÇÒÎÞ·¨Ê¹Óõ½ExcelÄÚ²¿µÄ¸÷ÖÖ¹«Ê½»òÊÇ·½·¨£¬Òò´Ë£¬½ñÌì½éÉÜÒ»¸öapache³öµÄÔª¼þ½ÐPOI£¬Ëü¿ÉÒÔÔÚUNIX»òwindowƽ̨´¦Àíword»òExcelµµ°¸£¬¶ø²»ÐèÒªÒÀ¿¿windowµÄcom£¬²¢ÇÒ¿ÉÉ趨´¢´æ¸ñ¸ñʽ¡¢ÁÐÓ¡¸ñʽµÈµÈ£»½ñÌìÎÒÀ´½éÉÜÆäÖÐÓйØ×ÊÁ϶ÁÈ¡¡¢ÐÂÔö¡¢Ð޸ļ°É¾³ýµÄ¹¦ÄÜ£¬Èô¸÷λÍøÓÑÑо¿ºÃÆäËûµÄ¹¦ÄÜ£¬Âé·³Email¸øÎÒ(ljj@mlc.edu.tw)£¬·ÖÏí¸ø´ó¼Ò£¡
Ò»¡¢ÐèÒªÓõĵµ°¸£ºjakarta-poi-1.8.0-dev-20020917.jar
¡¡¼¸ºõÿÌ춼ÓÐ1.8.0µÄ×îаæ(µ«·ÇÕýʽ°æ)£¬ÕýʽµÄ°æ±¾ÊÇ1.5.0
¡¡http://jakarta.apache.org/builds/jakarta-poi/nightly/
¡¡½«µµ°¸¸´ÖƵ½classpathËùÖ¸µ½µÄµØ·½
¶þ¡¢ÓÐÐËȤµÄÅóÓÑ¿ÉÒԲο¼
¡¡¡¡http://jakarta.apache.org/poi/
Èý¡¢ÏȽ¨Á¢Ò»¸ö½Ð×öbook1.xlsµÄExcelµµ£¬ÄÚÈÝÈçÏÂ
----------------------------------
ÏîÄ¿¡¡¡¡µ¥¼Û¡¡¡¡ÊýÁ¿¡¡¡¡ ºÏ¼Æ
CPU¡¡¡¡ 7000¡¡¡¡5¡¡¡¡¡¡¡¡35000
Ó²µú¡¡¡¡2500¡¡¡¡2¡¡¡¡¡¡¡¡5000
¼ÇÒäÌå¡¡1600¡¡¡¡3¡¡¡¡¡¡¡¡4800
----------------------------------
ÆäÖкϼƵÄÀ¸Î»ÊÇÉ趨¹«Ê½£¬µ¥¼Û*ÊýÁ¿
ËÄ¡¢×ÊÁ϶ÁÈ¡範Àý
<%@ page contentType="text/html;charset=MS950" import="java.util.*,java.io.*" %> ¡£
<%@ page import="org.apache.poi.poifs.filesystem.*,org.apache.poi.hssf.usermodel.*" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=MS950">
<title>¶ÁÈ¡Excelµµ°¸</title>
</head>
<body>
<table border="1" width="100%">
<%
FileInputStream finput = new FileInputStream(application.getRealPath("/") "book1.xls" );
//É趨FileINputStream¶ÁÈ¡Excelµµ
POIFSFileSystem fs = new POIFSFileSystem( finput );
HSSFWorkbook wb = new HSSFWorkbook(fs);
HSSFSheet sheet = wb.getSheetAt(0);
//¶ÁÈ¡µÚÒ»¸ö¹¤×÷±í£¬Ðû¸æÆäΪsheet
finput.close();
HSSFRow row=null;
//Ðû¸æÒ»ÁÐ
HSSFCell cell=null;
//Ðû¸æÒ»¸ö´¢´æ¸ñ
short i=0;
short y=0;
//ÒÔ³²×´迴Ȧ¶ÁÈ¡ËùÓд¢´æ¸ñ×ÊÁÏ
for (i=0;i<=sheet.getLastRowNum();i )
{
out.println("<tr>");
row=sheet.getRow(i);
for (y=0;y<row.getLastCellNum();y )
{
cell=row.getCell(y); .¡¡
Ïà¹ØÎĵµ£º
ÓеÄÒ³ÃæÐèҪÿ´Îµã»÷½øÈ¥¶¼¶¯Ì¬¸üУ¬¶ø²»ÊǶÁÈ¡»º´æÖеÄÒ³Ãæ¡£
ÔÚJSPÖпÉÒÔÕâÑùʵÏÖ£º
<%
request.setCharacterEncoding("GBK");
response.addDateHeader("Expires",0);
response.setHeader("Pragma","no-cache");
response.setHeader("Cache-Control","no-cache");
%> ......
ÏÖÔÚÖ÷Á÷µÄÍøÕ¾¿ª·¢ÓïÑÔÎÞÍâºõasp¡¢php¡¢asp.net¡¢jspµÈ¡£
ÍøÒ³´Ó¿ªÊ¼¼òµ¥µÄhmtlµ½¸´ÔӵķþÎñÓïÑÔ£¬×ß¹ýÁË10¶à¸öÄêÍ·£¬¸÷ÖÖ¼¼Êõ²ã³ö²»Çµ¥¸öµÄÖ÷Á÷¼¼ÊõÒ²ÔÚ²»¶Ï·Ðµİ汾£¬ÏÖÔÚ·ÖÎöϸ÷ÖÖÓïÑÔµÄÇø±ð¡¢ÓÅÊÆ¡¢ÁÓÊÆ¡¢¿ª·¢×¢ÒâÊÂÏ
HTML:µ±È»ÕâÊÇÍøÒ³×î»ù±¾µÄÓïÑÔ,ÿһ¸ö·þÎñÆ÷ÓïÑÔ¶¼ÐèÒªËüµÄÖ§³Ö,Ҫѧϰ,Õâ¸ö¿Ï¶¨ÊÇ¿ª ......
¸Õ¿ªÊ¼Ñ§jsp£¬×öµÄÒ»µãÌý¿Î±Ê¼Ç¡£
1.jspÈý´óÖ¸Áî
<%@ page ~~~~~~~~ %>
<%@ include file=""%>
<%@ taglib url="" prfix=""%>
2.if(username.equals(""))
out.println("ÐÕÃû²»ÄÜΪ¿Õ£¬Çë<a href=javascript:history.back()>·µ»Ø")£»
&&·ÀÖ¹Ö±½ÓÔÚä¯À ......
×ܵÄÀ´½²£¬JavaSever PagesTM£¨JSP£©ºÍ ΢ÈíµÄActive Sever Pages£¨ASP£©ÔÚ¼¼Êõ·½ÃæÓÐÐí¶àÏàËÆÖ®´¦¡£Á½Õ߶¼ÊÇΪ»ùÓÚWEBÓ¦ÓÃʵÏÖ¶¯Ì¬½»»¥ÍøÒ³ÖÆ×÷ÌṩµÄ¼¼Êõ»·¾³Ö§³Ö¡£Í¬µÈ³Ì¶ÈÉÏÀ´½²£¬Á½Õ߶¼Äܹ»Îª³ÌÐò¿ª·¢ÈËÔ±ÌṩʵÏÖÓ¦ÓóÌÐòµÄ±àÖÆÓë×Ô´ø×é¼þÉè¼ÆÍøÒ³´ÓÂß¼ÉÏ·ÖÀëµÄ¼¼Êõ¡£¶øÇÒÁ½Õ߶¼Äܹ»Ìæ´úCGIʹÍøÕ¾½¨ÉèÓë·¢Õ¹±äµÄ½ÏΪ ......