Hello World Web App using Spring Annotations Part 4

In part 4 of this series, we’ll finish off the configuration for the web application in Eclipse with Spring and Log4J configuration files.  We’ll also start the Tomcat server with Sysdeo and our dependencies loaded for the first time, and verify that Spring is working correctly.

Be sure you have set up Sysdeo Tomcat plugin and have your workspace setup as described if you want to follow along with the examples.  If you missed the previous parts, you can find them here: part 1, part 2, part 3.

Continue reading Hello World Web App using Spring Annotations Part 4

Hello World Web App using Spring Annotations Part 3

This is part 3 of a series of posts describing a Hello World web application built using Eclipse, Maven, Sysdeo, and Spring Annotations.  In part 1, we used a Maven archetype to build the initial structure of our application, and configured it as a Sysdeo Tomcat project.  In part 2, we set up the web application’s web.xml file, including a line-by-line walkthrough.

In this third post, we will begin adding in the JAR files that our web application depends upon.  We’ll use Maven to add those dependencies.

Continue reading Hello World Web App using Spring Annotations Part 3

Hello World Web App using Spring Annotations Part 2

In part 1 of this series, we set up a new web application project in Eclipse, using Maven and Sysdeo.

In this second of the Hello World web application posts, we’ll configure our application’s web.xml, and walk through the web.xml file line by line.

Continue reading Hello World Web App using Spring Annotations Part 2

Hello World Web App using Spring Annotations Part 1

I’ve used the Spring Framework to build web applications for several years now.  I learned the old-fashioned way (if there is such a thing) of Spring MVC: SimpleFormController, AbstractController, Wizard controllers, and the rest of the MVC package.  Recently though, I had a chance to start a project from ground zero and upgraded to Spring 3.0.0.  It was also a good chance to learn about Spring Annotations and how they could make my life easier.

This is the first of what I hope to be a series of posts about building web applications using the Spring Framework.  If you are completely new to Spring, this post will hopefully help you get over the initial hump of learning Spring.  If you are familiar with Spring, but not with annotations for web applications, these posts will give you some examples.

Like most of the Java projects on this site, I’ll be using Eclipse, Maven, and the Sysdeo Tomcat plug-in.  You may want to read the Using Java Projects and Setting up Sysdeo postings for more information.

In this first post, we will build a version the classic Hello World as a web application using Spring.  Here are the requirements and goals:

  • Use a Spring MVC controller and a JSP page to show a simple message
  • Use Spring Annotations instead of the old MVC package
  • Minimum amount of XML configuration (in fact, it is 27 lines of XML in the end)
  • The message must come from the controller, not be hard-coded into the JSP
  • Package the web application into a WAR file (using Maven)

Continue reading Hello World Web App using Spring Annotations Part 1

Using Live Writer with the WordPress SyntaxHighlighter plugin

Since this is likely to be a code-heavy blog and I had a bit of trouble getting the syntax highlighting to work with Live Writer, this seems to be a good first blog post.

In the end I decided to use one WordPress plugin and one Live Writer plugin.  They seem to work great together so far.  Both plugins make use of brilliant SyntaxHighlighter package by Alex Gorbatchev (you don’t need to install this.. it comes with the WordPress plugin).

The WordPress plugin is called SyntaxHighlighter Evolved by Viper007Bond.  Install this plugin into WordPress the usual way (wp-admin > Plugins > Add New).  After installing and activating the plugin, go into the plugin settings for SyntaxHighlighter Evolved and check the box that says "Always load all language files".  Save the new configuration.

The Live Writer plugin is called the PreCode Code Snippet Manager by Anthony Bouch.  Install this plugin into Live Writer.

I’ve tried several of the Live Writer code snippet plugins, and this is the only one I have found that correctly handles the PRE tags and doesn’t munge up my double quote symbols.

Once you have both plugins running, you can insert code into your blog posts from directly inside Live Writer.  Simply click on "PreCode Snippet" from the Live Writer sidebar, set your language and options, and insert your code!  The results looks like this:

// PHP Comment
function phpFunction() {
    echo "I'm a PHP Function";


// Java Comment
public class SomeJavaClass {

    public static void main(String args[]) {
        System.out.println("Java foo!");



<!-- XML Comment -->
    <SomeField someAttribute="foo">