Ben McCann

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

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


Using Struts 2 on Google App Engine


Google App Engine (GAE) has some great benefits such as scalability and the fact that it’s free to start.  When using Struts 2 with Google App Engine there a few things to keep in mind. The first is that it runs inside a security sandbox that is more restrictive than your typical Java environment.  This Read More

Case Study: Usable and Unusable APIs


It was the best of times, it was the worst of times… It was the age of wisdom, it was the season of light.  A great library called dom4j was written with its users in mind.  It included a quick start guide and a cookbook for people that actually wanted to get things done.  Converting Read More

Sample log4j.properties file


I always find the hardest part of getting started with log4j is creating a log4j.properties file. For that reason, I’ve posted an example below. This file configures log4j to log any messages of level info or higher to the console except for classes under the com.dappit.Dapper.parser or org.w3c.tidy packages. #—————————————————————————— # # The following properties Read More

Printing a Stack Trace anywhere in Java


You don’t need to catch an Exception in order to print a stack trace in Java.  Sometimes they can be helpful for debugging and logging purposes.  Here’s an example of how to print a stack trace at any moment: new Exception().printStackTrace(); If you want more control over the output, you can build some code off Read More

Maven on Eclipse Tutorial


Install Java and Maven First off, make sure you have a Java JDK installed and that your JAVA_HOME environment variable points to it. You can check by typing “echo %JAVA_HOME%” in Windows or “echo $JAVA_HOME” in Linux. You’ll next want to download and install Maven by following the directions on their website.  Once Maven is Read More

Using the GWT ClickListener on an Element


GWT uses what it calls a ClickListener instead of the standard HTML onclick attribute.  The normal way to use a GWT CLickListener would be as follows: focusWidget.addClickListener(new ClickListener() { public void onClick(Widget sender) { // do something here } }); Unfortunately, this seems not to work on an HTML Element.  Luckily, you can use JSNI Read More

Struts 2 Tutorial – Validation and Error Handling


Validation is an important part of any web framework because it is one of the most painfully repetitive things to have to continually recreate.  In Struts 2, validation is handled by creating an Action-validation.xml file.  So, if we have an AddUser Action then we would create an AddUser-validation.xml file: <!DOCTYPE validators PUBLIC “-//OpenSymphony Group//XWork Validator Read More

Struts 2 Tutorial – Struts Configuration


The struts.xml file defines the relationship between actions and .jsp views, the inclusion of interceptors, and possible result types.  It’s essential that you be able to handle at least basic configuration changes, so we’ll demonstrate the most important and frequently used below. Packages: Extension, Namespaces, and More For more complex applications, you will likely want Read More

Struts 2 Tutorial – Interceptors


Interceptors are my favorite aspect of Struts 2. They inspect and/or act on a user’s request. There are three main uses cases that I’ll discuss here: intercepting before the action, between the action and view, and after the view. At the end, I’ll show you how to add your brand spankin’ new interceptor to your Read More

Newer Posts
Older Posts