Java Excel API ʹÓ÷½·¨
ʹÓÃWindows²Ù×÷ϵͳµÄÅóÓѶÔExcel£¨µç×Ó±í¸ñ£©Ò»¶¨²»»áÄ°Éú£¬µ«ÊÇҪʹÓÃJavaÓïÑÔÀ´²Ù×ÝExcelÎļþ²¢²»ÊÇÒ»¼þÈÝÒ×µÄÊ¡£ÔÚWebÓ¦ÓÃÈÕÒæÊ¢ÐеĽñÌ죬ͨ¹ýWebÀ´²Ù×÷ExcelÎļþµÄÐèÇóÔ½À´Ô½Ç¿ÁÒ£¬Ä¿Ç°½ÏΪÁ÷ÐеIJÙ×÷ÊÇÔÚJSP»òServlet Öд´½¨Ò»¸öCSV £¨comma separated values£©Îļþ£¬²¢½«Õâ¸öÎļþÒÔMIME£¬text/csvÀàÐÍ·µ»Ø¸øä¯ÀÀÆ÷£¬½Ó×Åä¯ÀÀÆ÷µ÷ÓÃExcel²¢ÇÒÏÔʾCSVÎļþ¡£ÕâÑùÖ»ÊÇ˵¿ÉÒÔ·ÃÎʵ½ExcelÎļþ£¬µ«ÊÇ»¹²»ÄÜÕæÕýµÄ²Ù×ÝExcelÎļþ£¬±¾ÎĽ«¸ø´ó¼ÒÒ»¸ö¾ªÏ²£¬Ïò´ó¼Ò½éÉÜÒ»¸ö¿ª·ÅÔ´ÂëÏîÄ¿£¬Java Excel API£¬Ê¹ÓÃËü´ó¼Ò¾Í¿ÉÒÔ·½±ãµØ²Ù×ÝExcelÎļþÁË¡£
¡¡¡¡Java Excel API¼ò½é
¡¡ ¡¡Java ExcelÊÇÒ»¿ª·ÅÔ´ÂëÏîÄ¿£¬Í¨¹ýËüJava¿ª·¢ÈËÔ±¿ÉÒÔ¶ÁÈ¡ExcelÎļþµÄÄÚÈÝ¡¢´´½¨ÐµÄExcelÎļþ¡¢¸üÐÂÒѾ´æÔÚµÄExcelÎļþ¡£Ê¹Óøà API·ÇWindows²Ù×÷ϵͳҲ¿ÉÒÔͨ¹ý´¿JavaÓ¦ÓÃÀ´´¦ÀíExcelÊý¾Ý±í¡£ÒòΪÊÇʹÓÃJava±àдµÄ£¬ËùÒÔÎÒÃÇÔÚWebÓ¦ÓÃÖпÉÒÔͨ¹ýJSP¡¢ ServletÀ´µ÷ÓÃAPIʵÏÖ¶ÔExcelÊý¾Ý±íµÄ·ÃÎÊ¡£
¡¡¡¡ÏÖÔÚ·¢²¼µÄÎȶ¨°æ±¾ÊÇV2.0£¬ÌṩÒÔϹ¦ÄÜ£º
¡¡¡¡¡¡´ÓExcel 95¡¢97¡¢2000µÈ¸ñʽµÄÎļþÖжÁÈ¡Êý¾Ý£»
¡¡¡¡¡¡¶ÁÈ¡Excel¹«Ê½£¨¿ÉÒÔ¶ÁÈ¡Excel 97ÒÔºóµÄ¹«Ê½£©£»
¡¡¡¡¡¡Éú³ÉExcelÊý¾Ý±í£¨¸ñʽΪExcel 97£©£»
¡¡¡¡¡¡Ö§³Ö×ÖÌå¡¢Êý×Ö¡¢ÈÕÆڵĸñʽ»¯£»
¡¡¡¡¡¡Ö§³Öµ¥Ôª¸ñµÄÒõÓ°²Ù×÷£¬ÒÔ¼°ÑÕÉ«²Ù×÷£»
¡¡¡¡¡¡ÐÞ¸ÄÒѾ´æÔÚµÄÊý¾Ý±í£»
¡¡¡¡ÏÖÔÚ»¹²»Ö§³ÖÒÔϹ¦ÄÜ£¬µ«²»¾Ã¾Í»áÌṩÁË£º
¡¡¡¡¡¡²»Äܹ»¶Áȡͼ±íÐÅÏ¢£»
¡¡¡¡¡¡¿ÉÒÔ¶Á£¬µ«ÊDz»ÄÜÉú³É¹«Ê½£¬ÈκÎÀàÐ͹«Ê½×îºóµÄ¼ÆËãÖµ¶¼¿ÉÒÔ¶Á³ö£»
¡¡
¡¡¡¡ Ó¦ÓÃʾÀý
¡¡¡¡1¡¢´ÓExcelÎļþ¶ÁÈ¡Êý¾Ý±í
¡¡¡¡Java Excel API¼È¿ÉÒÔ´Ó±¾µØÎļþϵͳµÄÒ»¸öÎļþ(.xls)£¬Ò²¿ÉÒÔ´ÓÊäÈëÁ÷ÖжÁÈ¡ExcelÊý¾Ý±í¡£¶ÁÈ¡ExcelÊý¾Ý±íµÄµÚÒ»²½ÊÇ´´½¨Workbook(ÊõÓ¹¤×÷±¡)£¬ÏÂÃæµÄ´úÂëƬ¶Î¾ÙÀý˵Ã÷ÁËÓ¦¸ÃÈçºÎ²Ù×÷£º(ÍêÕû´úÂë¼ûExcelReading.java)
import java.io.*;
import jxl.*;
… … … …
try
{
//¹¹½¨Workbook¶ÔÏó, Ö»¶ÁWorkbook¶ÔÏó
//Ö±½Ó´Ó±¾µØÎļþ´´½¨Workbook
//´ÓÊäÈëÁ÷´´½¨Workbook
InputStream is = new FileInputStream(sourcefile);
jxl.Workbook rwb = Workbook.getWorkbook(is);
}
catch (Exception e)
{
e.printStackTrace();
}
¡¡¡¡Ò»µ©´´½¨ÁËWorkbook£¬ÎÒÃǾͿÉÒÔͨ¹ýËüÀ´·ÃÎÊExcel Sheet(ÊõÓ¹¤×÷±í)¡£²Î¿¼ÏÂÃæµÄ´úÂëƬ¶Î£º
//»ñÈ¡µÚÒ»ÕÅSheet±í
Sheet rs
Ïà¹ØÎĵµ£º
1¡¢ÖØÔØ(Overloading)
£¨1£©·½·¨ÖØÔØÊÇÈÃÀàÒÔͳһµÄ·½Ê½´¦Àí²»Í¬ÀàÐÍÊý¾ÝµÄÒ»ÖÖÊֶΡ£¶à¸öͬÃûº¯Êýͬʱ
´æÔÚ£¬¾ßÓв»Í¬µÄ²ÎÊý¸öÊý/ÀàÐÍ¡£ÖØÔØOverloadingÊÇÒ»¸öÀàÖжà̬ÐÔµÄÒ»ÖÖ±íÏÖ¡£
£¨2£©JavaµÄ·½·¨ÖØÔØ£¬¾ÍÊÇÔÚÀàÖпÉÒÔ´´½¨¶à¸ö·½·¨£¬ËüÃǾßÓÐÏàͬµÄÃû×Ö£¬µ«¾ß
Óв»Í¬µÄ²ÎÊýºÍ²»Í¬µÄ¶¨Òå¡£µ÷Ó÷½·¨Ê±Í¨¹ý´«µÝ¸øËüà ......
Java»ù´¡Ð¡½á(ÊýÖµÀàÐÍת»»¹æÔò)
Ò»¡¡ÊýÖµÀàÐÍת»»¹æÔò
ÊýÖµÐÍÊý¾Ý½øÐÐÔËËãʱ£¬Èç¹û²Ù×÷ÊýµÄÀàÐͲ»Í¬»ò²Ù×÷ÊýµÄÀàÐ;ùµÍÓÚintÐÍ£¬Ôò
»á½øÐÐ×Ô¶¯ÀàÐÍת»»´¦Àí£¬¾ßÌå¹æÔòÈçÏ£º
1)Èç¹ûÁ½¸ö²Ù×÷ÊýÖÐÓÐÒ»¸öÊÇdoubleÐÍ£¬ÔòϵͳÏȽ«ÁíÒ»¸ö²Ù×÷ÊýµÄֵת»»Îªdouble
ÐÍ£¬È»ºóÔÙ½øÐÐÔËË㣬·ñÔò
2)Èç¹ûÁ½¸ö²Ù×÷ÊýÖÐÓÐÒ»¸öÊÇfloat ......
package CH1;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class exercise001 extends JApplet {
// ¶¨Òå±äÁ¿
private JColorChooser chooser = new JColorChooser();
private JButton button = new JButton("Show Color Chooser");
private JDialog dialo ......
JavaÔÓ̸£¨Ê®Ò»£©??ORM
ÕâÊÇ×îºóһƪJavaÔÓ̸ÁË£¬ÒÔORM¿ò¼ÜµÄ̸ÂÛÊÕ⣬ҲËãÊÇ°ÑJ2eeµÄ×îºóÒ»·½Ãæ¸øº¸Çµ½ÁË£¬Ö®ËùÒÔÕâôÍí²Å×ܽá³öORMÕâ·½Ã棬һÊDZÊÕßÕâÁ½ÖܱȽÏ棬ÁíÒ»·½ÃæÒ²ÏëÉÆʼÉÆÖÕ£¬×ÐϸµÄÏÈ×Ô¼ººÃºÃÑо¿Ò»ÏÂORM¿ò¼Ü¼¼Êõ£¬²»Ïë²ÝÂʵķóÑÜÁËÊ¡£ &n ......
----------½Ó¿Ú------------
import java.rmi.*;
public interface HelloIn extends java.rmi.Remote{
String sayHello() throws RemoteException;
}
--------ʵÏÖÀà-------------
import java.rmi.*;
import java.net.*;
import java.rmi.registry.*;
import java.rmi.server.*;
public class Hello exten ......