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²åÈëmysqlÊý¾Ý¿â³öÏÖÂÒÂ룬mysqlÊý¾Ý¿â°²×°Ê±±àÂëÉèΪutf8£¬ÔÚÖ´ÐвåÈëÓï¾äµÄÇ°Ã棨½ô°¤×ÅÖ´ÐÐÓï¾ä£©Ìí¼ÓתÂëÓï¾ä£ºString na="";
try{
&nbs ......
JSPÒ³Ãæ¼ä´«µÝ²ÎÊý·½·¨½éÉÜ
±¾ÎĽéÉÜÁËJSPÒ³Ãæ¼ä´«µÝ²ÎÊýµÄ¼¸¸ö·½·¨¡£×îÖ±½ÓµÄ·½·¨¾ÍÊÇÖ±½ÓÔÚURLÇëÇóºóÌí¼Ó£¬²»¹ý¶à¸öÒ³ÃæµÄÇé¿ö»á¸´ÔÓһЩ¡£
JSPÒ³Ãæ¼ä´«µÝ²ÎÊýÊǾ³£ÐèҪʹÓõ½µÄ¹¦ÄÜ£¬ÓÐʱ»¹ÐèÒª¶à¸öJSPÒ³Ãæ¼ä´«µÝ²ÎÊý¡£ÏÂÃæ½éÉÜÒ»ÏÂʵÏֵķ½·¨¡£
£¨1£©Ö±½ÓÔÚURLÇëÇóºóÌí¼Ó
È磺< a href="thexuan.jsp?action=t ......
JSP×÷ΪºóÆðÖ®ÐãÄܹ»ÔÚ·þÎñÆ÷±à³Ì»·¾³ÖÐÕ¼¾ÝÒ»¶¨µØ룬ÊǺÍËüÁ¼ºÃÖ§³ÖһϵÁÐÒµ½ç±ê×¼ÃÜÇÐÏà¹ØµÄ¡£Session¾ÍÊÇËüÌṩµÄ»ù´¡ÉèÊ©Ö®Ò»¡£×÷Ϊһ¸ö³ÌÐòÔ±£¬Äã¿ÉÒÔ²»½éÒâ¾ßÌåÔÚ¿Í»§¶ËÊÇÈçºÎʵÏÖ£¬¾Í·½±ãµÄʵÏÖ¼òµ¥µÄ»ùÓÚsessionµÄÓû§¹ÜÀí¡£ÏÖÔÚ¶ÔÓÚ´¦ÀíÔÚÏßÓû§£¬Óм¸ÖÖ²»Í¬µÄ´¦Àí·½·¨¡£
¡¡¡¡Ò»ÖÖÊÇÒ³ÃæË¢ÐÂÓÉÓû§¿ØÖÆ£¬·þÎñÆ÷ ......
Ò»£¬jsp³öÏֵĵÄÔÒò
¿´Á½¶Î´úÂëµÄ¶Ô±È
1 servletʵÏÖ
public class Welcome extends HttpServlet {
int num = 1;
public void doGet(HttpServletRequest request,
&nbs ......
JSP/Servlet µÄ¹Øϵ
JSP £¦Servlet ÊôÓÚjava web ²ãµÄ¼¼Êõ£¬×÷Óö¼ÊÇÓÃÀ´ÊµÏÖ¶¯Ì¬ÍøÒ³¡£JSP Ö÷ÒªÃæÏòµÄÊÇÍøÒ³Éè¼ÆÈËÔ±£¬Servlet Ö÷ÒªÃæÏòµÄÊdzÌÐòÉè¼ÆÈËÔ±¡£ÎÞÂÛÄã²ÉÓÃÁ½ÕßÖÐÄÄÒ»ÖÖµ¥Ò»µÄ¼¼Êõ£¬Ä㶼¿ÉÒÔ½â¾öËùÓж¯Ì¬ÍøÒ³³ÊÏÖµÄÎÊÌâ¡£´ÓÔËÐз½Ê½ÉϽ²£¬JSP ÊÂʵÉÏÐèҪתÒëΪServlet ²ÅÄÜÔËÐУ¬ËùÒÔ£¬ÓÐÒ»ÖÖ˵·¨ËµËüÃÇÊÇ"һà ......