Articles Section Index | Page 5
Well, this is very simple and the basic structure of an applet will be the same for every applet you will program. The major difference between an applet and an application is that there is no publ...more
Java contains a lot of useful utility packages. One is java.util with its lists, maps, and calendar stuff--a lot to look into and use in your applications. Another package, java.io, contains what y...more
For testing our programs we need a simple directory structure, with a few files and a few directories. Something along the lines of this:
Outputting results to System.out is not actually cutting edge technology, so let's consider showing the directory structure in some other formats. In the first one we'll present the output as an HT...more
The class for the directory is also rather simple, but this class also has to keep track of the files and directories it contains. Let's use two Vectors for this purpose. Since the code is so simpl...more
If you show this jsp-file in an XML-aware browser like Microsoft Internet Explorer 5.5 you'll get this picture:
One of the advantages of using your own exception class is that you can format the data and the trace back like you want it.
One of the things which are saved in our exception class is the exception it has just caught. By doing this we'll get a linked list of exception classes, that can document the calling sequence "top...more
Testing programs can be very boring. Especially testing other people's programs. And especially if you're a programmer. But programmers love to write programs, so why not let the programmers write ...more
During the development of a web-project you'll build more and more test cases, which all may be run individually, but often you'll want to run more or all of them in one go.
JUnit is a Java open source project which offers an extremely useful framework for unit testing.
For the Round class we'll need a method--newScore--to enter the strokes for the hole we've just played. To get the current score we define a method called currentScore.
Filters are an under-appreciated feature of the Java servlet platform, ideal for writing components that can be added transparently to any web application. A filter is like a lightweight servlet th...more
Another use for filters is to restrict access to resources - if a filter doesn't call FilterChain.doFilter(), the resource won't be loaded. Simply returning would send an empty document to the brow...more
Now we need to tell the servlet container when to apply the filter, which is done with a block. The filter-mapping block includes the filter-name, which must match the name given in a block, and ...more