Some reader favorites:
EJB fundamentals and session beans
Create a scrollable virtual desktop in Swing
More action with Struts 2
In a recent review of Struts 2 in Action, JW Blogger Oleg Mikheev notes that Struts 2 is "just a collection of extensions built upon WebWork, which is ultimately
the right thing to learn before starting a Struts 2 project." While Struts 2 has some architectural flaws, Oleg calls WebWork
well-designed, well-tested, and reliable. What are your experiences using Struts 2 and WebWork?
Also see "Hello World the WebWork way," a JavaWorld excerpt from WebWork in Action, by Patrick Lightbody and Jason Carreira.
| Memory Analysis in Eclipse |
| Enterprise AJAX - Transcend the Hype |
main().
We'll conclude with some more discussion of the specifics of the implementation. This column teaches concepts and the applets don't really do anything useful other than serve as an instructional vehicle.
The following examples demonstrate the use of the serialization technology that has been included in JDK 1.0.2. An add-on package is required to run the following applets. The applets below were run with the JDK appletviewer on Windows 95 and Solaris. I was unable to find a browser manufacturer that clearly stated what version of the JDK they were running and decided that it was best to wait for Microsoft and Netscape to get up to speed with the up and coming JDK 1.1 release. If you have problems installing the serialization classes needed on your system try looking at this FAQ. The javaSoft team has also been nice enough to collect all the mail messages for those of you wishing to find quick answers to questions.
CLASSPATH environment variable to include the lib/rmi.zip file in the RMI directory.
CLASSPATH. Use the appletviewer or the Java virtual machine to run the applets below.
The following two applets save an object and retrieve some classes. Because they are writing to the disk you will have to
run these programs locally on your system. The ShowSavingAClass applet saves a String and a Date class to a disk file called SavedObject in the current directory. ShowReadingAClass reads the saved file SavedObject and recreates the classes contained in it. If your browser has RMI support then you can run the following two applets:
The programs require that a server program be running on the server so that an applet or Java application can communicate over the port to save objects.
The program WriteObjectsFromSocket reads an object from a client and saves it on the server in a fixed area. Here's the source. To create a file on a server that contains an instance of the object run the following:
java WriteObjectsFromSocket servername portnumber,
ShowSavingAClassNet. Here's the source. Don't forget to modify the HTML parameter tags if you host this applet on your local system.
The source code for ShowSavingAClassNet.java contains an example of designing applets that use the same source code for both so that users can start them with or without
the applet viewer.
The ShowWritedouble applet writes 10,000 double objects to a disk file. You can easily modify this to write other data types and get a feeling
for how long it takes to save an object. This applet can easily be modified to retrieve the objects also.
When designing classes that may be serialized be aware of the fact that all methods and data will be saved so try to optimize space usage and practice encapsulation. There are some important security restrictions described in the documentation of the RMI classes. The special handling of private maintains Java's strict security model. Those of you wishing more information can take a look at reflection. The following questions arose during the development of these instructional applets:
CLASSPATH.