Using Assertions in Java

Steve Neal Development, Java Programming 1 Comment

I’ve been working on a project this week and have been delighted to see that the original team of programmers who developed it have made the effort to use assertions in their code. The assert keyword was introduced in Java 1.4 and has since been a sadly under-used language feature. Assertions offer developers a neat way to implement error detecting …

Programming with Inner Classes in Java

Steve Neal Development, Java Programming Leave a Comment

Inner classes are an advanced programming feature in Java. They add another dimension to the concept of Object Oriented programming by allowing objects to not only reside alongside one another, but also within one another too. In this post I’ll explain how inner classes work with the help of an example that illustrates their most common use: Swing GUI programming.

How to Access the Size of a Collection in a JSP Page Using JSTL-EL

Steve Neal Development, Java Programming 13 Comments

A common and frustrating problem that many programmers encounter when first working with JSPs is how to access the size of a Collection using the JavaServer Pages Standard Tag Library (JSTL) and the Expression Language (EL). This article discusses this problem and illustrates a best practice solution. The Problem The JSTL and EL greatly reduce the amount of Java code …

Exposing Spring Beans as JMX Managed Beans in Tomcat

Steve Neal Development, Java Programming 4 Comments

JMX provides a simple solution to application management. In this article, we’ll look at how Spring beans can be easily exported as a JMX MBean making their methods and properties available from a JMX client application, such as JConsole. This technique has the following advantages: Your Java bean’s methods can be triggered manually and interactively (great for application development and …

Packaging JavaME Applications with the Antic Ant task

Steve Neal Development, Java Programming, Tool support 2 Comments

This article illustrates just how simple it is to correctly package a Java ME Midlet using Smartkey’s freely available Antic Ant task. Packaging Midlets Packaging Midlets can be a complex process. Firstly, there are requirements for two files to be created: a Jar and a Jad file. The Jar file will contain all of the classes and other resources that …