There is no right answer to the question of what is the best Java web framework. Still I end up asking it to myself every time a new project crops up. I did a post on a related talk I saw at JavaOne last year, which provoked a lot of debate and some really interesting responses. More recently, this report from Zero Turnaround is useful and this comparison from Matt Raible is also well written.

I have also been swayed in the past by the Thoughtworks technology radar in which component based frameworks (which, I think, in the Java world includes JSF, Wicket and Tapestry) get a thumbs down e.g. see the May 2013 radar. GWT has also in the past (see July 2011 radar) been singled out as something to avoid. Presumably Vaadin falls in to the same ‘hold’ category. Full disclosure, I’ve had limited exposure to these types of frameworks personally though.

My own preference remains Spring MVC. It is relatively easy to setup (especially with Spring Boot), provides decent testing support, and obviously integrates well with the rest of the Spring ecosystem. I am admittedly biased due to already knowing Spring core, but so be it.

My recent, albeit limited, experience with Struts2 is that I have been fairly pleasantly surprised. It wasn’t as bad I was expecting! The Action classes, which are instantiated for each request, and hence threadsafe, are fairly easy to use and test. I am not so fond of the xml mappings and the variable passing that gets done there though. It seems kind of clunky, although there may be a better way I am not aware off.

Although the GitHub docs contains good info on how to add an existing GitHub project to your local machine, how to add an existing (unversioned) project from your local machine to GitHub was a little less clear to me. Here are the steps I use.

Mavenarchetypes are useful for many things, including creating a folder structure to start with, even if you aren’t planning to use maven as your build tool. See a list of available archetypes here.(more…)

Handsontable is an Excel-like data grid utilizing JQuery. For example, it provides the ability to copy and paste directly to & from Excel. Handsontable itself if very easy to setup. The part I struggled with was passing the data to SpringMVC. So, this post shows how to send data from a Handsontable data grid on the client to a SpringMVC server.

I created a small, open source web app called MyMoney for entering and tracking spending details. It allows you to create accounts (for example Cash or Checking) and enter transactions associated with those accounts.

(Previously I had the code deployed on a CloudBees instance at http://mymoney.shaunabram.cloudbees.net, but CloudBees have since unfortunately shut down their free tier). Read more

Oh dear, yet another ‘Hello World!’. But although the functionality is trivial, this little SpringMVC project is complete enough for me to use as a template to bootstrap more complex projects. It consists of:

HTML/JSP client

SpringMVC server using a Controller/Service/DAO design

Maven for build and dependency management

This is an updated version of an older project I created, with the following enhancements:

Added a full suite of automated tests (unit, integration and browser based)

Added placeholders for JavaScript and images (both can be a little tricky to put in the correct place with SpringMVC)

I am a huge fan of the Jenkins continuous integration tool, using it not just for continuous integration, but also continuous delivery, server monitoring and performance testing.

Although using Jenkins is normally a breeze, I recently had a need to run several Jenkins jobs sequentially and it proved a little trickier than expected, so I thought worth posting about.

Basically, I wanted to call a database backup job before calling the deploy build job, which obviously shouldn’t be done in parallel. After a bit of research, I found a number of ways to have Jenkins run jobs sequentially.Read more

I’m at a Cloud Foundry conference today. Cloud Foundry is an open source “cloud” platform as a service (PaaS).

I decided to dive in and try to deploy the server we developed at GiveCamp last week for the ‘Big Brothers and Big Sisters’ charity project. I started by mavenizing the project, so I had a war to deploy.

Then, I created a free Cloud Foundry account, installed their ‘vmc’ command line tool and ran the ‘vmc push’ command to deploy my way to the cloud. And it worked straight off! Don’t you just love it when tools just work?

Our webservice is now running on a remote server that can be accessed by the iPhone and Android apps the team is developing. We still have some database work to complete, but this feels like a nice step forward.

Had a great weekend at the Central California GiveCamp in Fresno this weekend. I joined the Big Brothers and Big Sisters team, working on a mobile app (Android & iPhone). I helped out on the server & database side where we created a Java WebService talking JSON, with a MySQL database. Most of the team were from Fresno State. Still some work do to deploying the solution to the cloud, but we made good progress.

It was a really enjoyable weekend, and all for a good cause. Thanks to Walt Read and Iran Rodrigues for setting up and running it all so smoothly, and Dr Alex Liu from Fresno State for organizing the team…

I have spent the last few weeks struggling with a Swing app that I wanted to deploy via Webstart and build using Maven, via the the Webstart Maven Plugin. It has been a hugely painful process. I found the plugin documentation difficult to follow, struggled to understand the subtle config differences in jnlp, took longer than I expected to get jar signing working, had problems with webstart caching and suffered through a plethora of vague error messages. I found this posting where the author vowed to never use Webstart again, and I can empathize. Postings of people asking for help with Webstart problems certainly aren’t difficult to find. Using maven to build the jnlp provides some conveniences, but introduces new problems too. Overall, I’d prefer to avoid using a Swing/Webstart/Maven solution again.Read more

I have created several Spring MVC projects for both work and play, and am attaching my own simple version of the HelloWorld example here, based on the Spring blog example.
Find my maven ready source here.
Like my previous JSP/Servlet example, I find these templates useful for getting prototypes up and running.

I still default to log4j, but it sounds like logback (as the new alternative to log4j), wrapped by SLF4J (as the new alternative to commons logging) is the way forward. Both are written by Ceki Gülcü (blog), the original log4j author.

With multiple tomcat instances, each can run in its own JVM, have its own configuration and can be started/stopped independently.

One approach to doing this would be to have multiple, full tomcat installations. This article instead details how to install tomcat once (in CATALINA_HOME) but have multiple independent instances (by utilizing CATALINA_BASE). This is a more streamlined approach that makes creating multiple instances easier and also simplifies upgrades/rollbacks of tomcat.