Quantcast

Ben McCann

Co-founder at Connectifier.
ex-Googler. CMU alum.

Ben McCann on LinkedIn Ben McCann on AngelList Ben McCann on Twitter

Java

Struts 2 Tutorial – Creating Views

09/09/2008

One of the first things you’ll want to do after getting started with Struts 2 is create more complex user interfaces. We call the UI a view because Struts2 makes use of the Model-View-Controller (MVC) design pattern.  For this example, let’s assume we have an action that returns a list of all the employees at Read More

Struts 2 Tutorial – Getting Started

09/08/2008

Struts 2 is an MVC web development framework.  It is based off of Web Work and has far less configuration than the original Struts.  I would strongly recommend Struts 2 over Struts for new development due to the faster development times it allows.  This is a very simple example and follow up posts will be Read More

SiteMesh Tutorial with Examples

09/07/2008

SiteMesh is a web layout framework for Java.  It differs from from frameworks such as Tiles in that it utilizes the decorator pattern.  For example, you create a number of pages and then you tell SiteMesh that you’d like to add the same header, footer, and menus to each of those pages.  This tutorial will Read More

Easy Java Bean toString() using BeanUtils

07/10/2008

I often want to have a String description of my beans for debugging or logging purposes, but hate having to manually concatenate the fields in my class to create a toString() method. This code snippet using Apache Commons is very helpful for just such occasions. Thanks to Paul Wilton who suggested this updated code snippet in Read More

HTML Parsing using the Firefox DLLs

03/21/2008

One of my first posts was a comparison of HTML parsers. Today I found a particularly challenging document to parse. None of the parsers I had compared earlier were able to handle the malformed HTML in this table where the td elements were prematurely ended. The behavior of Neko and HtmlCleaner made the most sense Read More

Change the NetBeans Default JDK

03/04/2008

A client sent me some code today to update. He was using the NetBeans, so I downloaded the IDE and fired it up to open the project he’d sent me. Unfortunately, the project wouldn’t compile because he’d written the code in Java 6 while NetBeans was using Java 5. I couldn’t find a NetBeans menu Read More

Suppressing Compile Warnings with Java Annotations

02/23/2008

If you’ve used Java 1.5 Generics much then you’re probably familiar with the following compile warning: “Type safety: The expression of type List needs unchecked conversion to conform to List<String>” or similar. It turns out there’s a rather simple solution with annotations to ignore this problem: @SuppressWarnings(“unchecked”) A couple other possible uses of the annotation Read More

Apache CXF Tutorial – WS-Security with Spring

02/19/2008

This tutorial will cover adding an authentication component to your web service though WS-Security. If you need an overview of how to setup CXF then you may find our previous tutorial helpful. Another helpful resource is CXF’s own WS-Security tutorial. However, it does not include information on how to setup the client through Spring. To Read More

Newer Posts
Older Posts