content top

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.

Read More

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.

Read More

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.

Read More

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)
Read More
content top