Some reader favorites:
EJB fundamentals and session beans
Create a scrollable virtual desktop in Swing
Wizard API updated!
Tim Boudreau has released a new version of the Swing Wizard library (version 0.997) that fixes the WizardException bug reported in JavaWorld's recent Open Source Java Project profile. The article's examples have been reworked to test out the new, improved WizardException. Thanks, Tim, for this helpful fix!
Open Source Java Projects: The Wizard API
To understand why the new applet loading method is fast, you need to know why the current method is so slow. A given applet usually is composed of a number of Java .class files. For each of those class files, the class loader must open an individual socket connection from your browser to the server that the applet code resides on. So, if your applet is composed of 18 .class files, the browser must open at least 18 sockets so it can transfer each one of those files. The overhead to set up and tear down each of those connections is quite significant. For example, each connection set up requires a number of network packet round-trips, which greatly increases the overall latency (especially in these times of the increasingly congested 'Net). (For the nitty-gritty details of socket connection overhead, check out one of the weighty TCP/IP reference tomes.)
By this point you have already figured out the solution to this problem: Put all of the .class files into one big file so only one connection must be made to download everything. Good thinking! That's exactly what the folks at the two big Java browser camps (Netscape and Microsoft) thought of.
Unfortunately, the two solutions that they came up with are not directly compatible. Microsoft, in its need to be different, created its own CAB file format. The Netscape solution is to use the existing, well-known .zip archive file format. Luckily, we can write our HTML code to handle both formats if we want to. This is because each of those special file formats is specified by a separate extension to the <APPLET> HTML tag.
I'm not going to speak to the creation of CAB files (since they should be going away). For those who are really interested, check out the Microsoft Java developer documentation. Once you have created a CAB archive you can use it by adding a cabbase HTML parameter to the <APPLET> tag:
<applet name="Hello" code="HelloWorld" width="50" height="50"> <param name=codebase value="http://www.foo.com/classes"> <param name=cabbase value="hello.cab"> </applet>
The value of the cabbase parameter is the name of the CAB file.
Creating a .zip file archive that can be used with the Netscape browser is easy. Zip up all of the .class files that are needed for your applet into a single .zip file. The only thing to remember is that you must only store the files into the archive (that is, no compression)!
If you are using PKZip:
pkzip -e0 fileArchive.zip listOfClassFiles
If you are using the Info-Zip Zip program:
zip -0 fileArchive.zip listOfClassFiles
Note that in both cases, the command-line flag contains a zero rather than a letter "O";
Free Download - 5 Minute Product Review. When slow equals Off: Manage the complexity of Web applications - Symphoniq
![]()
Free Download - 5 Minute Product Review. Realize the benefits of real user monitoring in less than an hour. - Symphoniq