Serializable javaÐòÁл¯
Bean Serializable Interface µÄ½Ó¿ÚÈÃBEAN¿ÉÒÔ´®Ðл¯£¬½«Æä±ä³ÉÒ»¸ö¿É±£´æΪÒÔºóʹÓõĶþ½øÖÆÁ÷¡£µ±Ò»¸öBEAN±»ÏµÁл¯µ½´ÅÅÌÉÏ»òÕßÆäËûÈκεط½£¬Æä״̬±»±£´æÆðÀ´£¬ÆäÖеÄÊôÐÔÖµÒ²²»»á¸Ä±ä¡£ÔÚBEANµÄ¹æ·¶ÖУ¬JSP²¢Ã»ÓÐÒªÇóBEANʵÏÖSerializable½Ó¿Ú¡£µ«ÊÇ£¬Èç¹ûÄúÏ£Íû×Ô¼º¿ØÖÆÄúËù´´½¨µÄ×é¼þµÄserialization½ø³Ì£¬»òÕßÄúÏëserialize²¢²»ÊDZê×¼×é¼þÀ©Õ¹µÄ×é¼þ£¬Äú±ØÐëÁ˽âserialization and deserializationµÄϸ½Ú¡£
¡¡¡¡Óм¸¸öÔÒòÄã»á°ÑBEANÀä²ØÆðÀ´ÒÔ±¸ºóÓá£ÓÐЩ·þÎñÆ÷ͨ¹ý½«ËùÓеÄSESSION Êý¾Ý£¨°üÀ¨BEAN£©Ð´Èë´ÅÅÌÀ´Ö§³ÖÈÎÒⳤµÄSESSIONÉúÃüÆÚ£¬¼´Ê¹·þÎñÆ÷Í£»úÒ²²»»á¶ªÊ§¡£µ±·þÎñÆ÷ÖØÐÂÆô¶¯ºó£¬´®Ðл¯µÄÊý¾Ý±»»Ö¸´¡£Í¬ÑùµÄÀíÓÉ£¬ÔÚÖظºÔصÄÕ¾µãÉÏÖ§³Ö·þÎñÆ÷·Ö´ØµÄ»·¾³ÖУ¬Ðí¶à·þÎñÆ÷ͨ¹ý´®Ðл¯À´¸´ÖÆSESSION¡£Èç¹ûÄãµÄBEAN²»Ö§³Ö´®Ðл¯£¬·þÎñÆ÷¾Í²»ÄÜÕýÈ·µØ±£´æºÍ´«ÊäÀà¡£
¡¡¡¡Í¨¹ýͬÑùµÄ²ßÂÔ£¬Äã¿ÉÒÔÑ¡Ôñ½«BEAN±£´æÔÚ´ÅÅÌÉÏ»òÕßÊý¾Ý¿âÖУ¬ÒÔ±¸ºóÓá£ÀýÈ磬ҲÐí¿ÉÒÔ½«¿Í»§µÄ¹ºÎﳵʵÏÖΪһ¸öBEAN£¬ÔÚ·ÃÎÊÆڼ佫Æä±£´æÔÚÊý¾Ý¿âÖС£
¡¡¡¡Èç¹ûBEANÐèÒªÌØÊâµÄ¸´ÔӵijõʼÉèÖ㬿ÉÒÔ½«BEANÉèÖúúó´®Ðл¯±£´æÔÚ´ÅÅÌÉÏ¡£Õâ¸öBEANµÄ“¿ìÕÕ”¿ÉÒÔÓÃÔÚÈκÎÐèÒªµÄµØ·½£¬°üÀ¨ÔÚ$#@60;jsp:useBean$#@62;ÖÐÓÃbeanNameÊôÐԵĵ÷Óá£
¡¡¡¡$#@60;jsp:useBean$#@62;±êÇ©ÖеÄbeanNameÊôÐÔ£¬ÓÃÀ´ÊµÀý»¯Ò»¸ö´®Ðл¯µÄBEAN£¬¶ø²»ÊÇÓÃÀ´´ÓÒ»¸öÀà´´½¨Ò»¸öȫеÄʵÀý¡£Èç¹ûBEAN»¹Ã»Óд´½¨£¬beanNameÊôÐÔ´«¸øjava.beans.Bean.instantiate()·½·¨£¬ÓÉÀà×°ÔØÆ÷¶ÔÀà½øÐÐʵÀý»¯¡£ËüÊ×Ïȼٶ¨´æÔÚÒ»¸ö´®Ðл¯µÄBEAN£¨´øÓÐÀ©Õ¹Ãû.ser£©£¬È»ºó»á½«Æ伤»î¡£Èç¹ûÕâ¸ö²Ù×÷ʧ°Ü£¬Ëü¾Í»áʵÀý»¯Ò»¸öеÄʵÀý¡£
¡¡¡¡ÏÂÃæ¼òµ¥½éÉÜÒ»ÏÂÕâ¸ö½Ó¿Ú£º
¡¡¡¡¶ÔÏóÄÜ°üº¬ÆäËüµÄ¶ÔÏ󣬶øÕâÆäËüµÄ¶ÔÏóÓÖ¿ÉÒÔ°üº¬ÁíÍâµÄ¶ÔÏó¡£JAVA serializationÄܹ»×Ô¶¯µÄ´¦ÀíǶÌ׵ĶÔÏ󡣶ÔÓÚÒ»¸ö¶ÔÏóµÄ¼òµ¥µÄÓò£¬writeObject()Ö±½Ó½«ÖµÐ´ÈëÁ÷¡£¶ø£¬µ±Óöµ½Ò»¸ö¶ÔÏóÓòʱ£¬writeObject()±»Ôٴε÷Óã¬Èç¹ûÕâ¸ö¶ÔÏóÄÚǶÁíÒ»¸ö¶ÔÏó£¬ÄÇô£¬writeObject() ÓÖ±»µ÷Óã¬Ö±µ½¶ÔÏóÄܱ»Ö±½ÓдÈëÁ÷Ϊֹ¡£³ÌÐòÔ±ËùÐèÒª×öµÄÊǽ«¶ÔÏó´«ÈëObjectOutputStream µÄwriteObject() ·½·¨£¬Ê£ÏµĽ«ÓÖϵͳ×Ô¶¯Íê³É¡£ÏÂÃæµÄÀý×Ó´´½¨ÁËÒ»¸öµ÷ÓÃmine¶ÔÏóµÄPersonalData¶ÔÏó¡£´úÂëʵÏÖµÄÊǽ«Ò»¸ö´®ºÍmine ¶ÔÏóÊä³öµ½Ò»¸öÁ÷£¬²¢´æÈëÒ»¸öÎļþ£º
public class PersonalData implements Serializable {
public int id
public int yearOf
Ïà¹ØÎĵµ£º
²âÊÔ»·¾³£º
SDK£ºOracle JRockit for Java version 6, Java Communication for Windows 2.0
OS£ºWINDOWS7
ÍâÉ裺´®¿ÚÌõÐÎÂëɨÃèǹ
Server£ºTomcat6
¿´ÁËÍøÉÏÁ¼Ý¬²»ÆëµÄ¹ØÓÚApplet·ÃÎÊ´®¿ÚµÄÎÄÕ£¬×ܽáÆðÀ´Ëù¹Ø×¢µÄÎÊÌâÎÞÍâºõÒÔÏÂ3¸ö£º
1. Èý¸öÎļþ£¨comm.jar¡¢javax.comm.propertiesºÍwin3 ......
ÏÂÃæµÄ³ÌÐò½«´òÓ¡Ò»¸öµ¥´Ê£¬ÆäµÚÒ»¸ö×ÖĸÊÇÓÉÒ»¸öËæ»úÊýÉú³ÉÆ÷À´Ñ¡ÔñµÄ¡£ÇëÃèÊö¸Ã³ÌÐòµÄÐÐΪ£º
import java.util.Random;
public class Rhymes {
private static Random rnd = new Random();
public static void main(String[] args) {
StringBuffer word = null;
switch(rnd.nextInt(2)) {
......
´ò¿ªÖնˣ¬Ö´ÐÐÒÔÏÂÃüÁ»òʹÓÃAdept/ÐÂÁ¢µÃÈí¼þ¹ÜÀíÆ÷£¬ÔÚÆäÖÐËÑË÷"sun-java6-jdk"²¢±ê¼Ç°²×°¡£
sudo apt-get install sun-java6-jdk
Ìáʾ£º°²×°¹ý³ÌÖÐÐèÒªÄã»Ø´ðÊÇ·ñͬÒâʹÓÃÐÒ飨ÖÕ¶ËÖкìÀ¶É«µÄÌáʾ½çÃ棩£¬´Ëʱ°´tab¼üÖÁOK£¬ÔÙ°´»Ø³µ¼´¿ÉÕý³£°²×°¡£
* ÉèÖõ±Ç°Ä¬ÈϵÄjava½âÊÍÆ÷ºÍ±àÒ ......
package ui;
import java.awt.AWTEvent;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
impor ......
ÎÒÏÖÔÚ¸øÄãÒ»¸öJAVAºÍJSPÖ®¼äµÄ¹Øϵ,ÒÔ¼°JAVAµÄÍêÕûÈÏʶ
JAVA·ÖΪJ2EE,J2SE.J2ME,ÏÂÃæ·Ö±ð½éÉÜ:
Ò».J2EE£ºJava 2 Platform Enterprise Edition ÆóÒµ°æ£¬ÓÃÓÚÆóÒµÓ¦Óã¬Ö§³Ö·Ö²¼Ê½²¿Êð¡£
J2EEƽ̨ÓÉÒ»ÕûÌ×·þÎñ£¨Services£©¡¢Ó¦ÓóÌÐò½Ó¿Ú£¨APIs£©ºÍÐÒé¹¹³É£¬
Ëü¶Ô¿ª·¢»ùÓÚWebµÄ¶à²ãÓ¦ÓÃÌṩÁ˹¦ÄÜÉϵÄÖ§³Ö¡£Ëü°ü ......