Chapter 2. Building a User Interface

I was hauling down a trail called Emma Long, and came up to a four-foot drop. In a split second, I had to make the decision of whether to jump the ledge, try to ride down it, or stop and get off my bike. I once read that in Austin, Texas, there are more broken mountain bike frames than any other place, per capita. Though I've never confirmed it, I believe it, because there are so many rocky trails with ledges that are small enough to handle sometimes with a cheap bike, but also big enough to snap the frame. Web-based user interface development is similar. It's easy to get started down that trail with a bike that's not quite up to the task. Often, it's the framework and organization of the code that's just behind the user interface that presents the biggest problem. In this chapter, you'll learn how Spring can help. We'll focus on Spring's Web MVC framework, but in the next chapter, we'll also show you how to integrate alternative frameworks, and even use rich clients.

Setting Up Tomcat

In this first example, you'll learn how to build a simple user interface with Tomcat with Spring's Web MVC framework. You'll add a couple of screens to add bikes to the inventory of rental bikes. Then, we'll add a hardwired JSP that will let you add a new bike to the database.

Note

Spring doesn't force you to use a full application server. Actually, you don't even have to build web-based applications. The requirement for Tomcat is really a requirement for some servlet ...

Get Spring: A Developer's Notebook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.