Software By JeffMain Page | About | Help | FAQ | Special pages | Log in
The Free Encyclopedia
Printable version | Disclaimers

Setting Up Struts

From Software By Jeff

Starting with Struts - Setting Up Struts - Struts Webserver Configuration - Our Struts Classes - Our Struts Web Pages - Struts Server Deployment - Making Struts Projects in IDEs

When downloading the Struts package, there's an example WAR that one is encouraged to extract and mutate into your own project, removing the example bits that won't get used, and renaming or duplicating the bits that will. That's a poor way to start, especially if you want to understand what's required to make things work. Even more if you want to minimize a WAR.

The documentation at the Apache website leaves a lot to be desired in this space, too. Even the two Struts books I picked up for the purpose of learning these bits is a little terse in these areas. Both of them provide examples, and then text that should help encourage you to feel excited because the examples work. I'm sure that's a hard bit to miss when writing these texts, but I'm gonna try. We'll make a very simple "hello world" Struts application, hopefully describing enough along the way that you can skip the "copy and alter" method, and just create what you need without wasting your time cleaning up our unncessary bits.

I'm not going to define Struts or proclaim its virtues over other technologies, frameworks, patters, or however you categorize it. I'm not going to pitch a preferred methodology. I'm just going to describe the pieces and how they fit together, and a little bit of how to make them work in our favorite IDEs NetBeans ( and Eclipse (, and how to deploy them to our favorite servers like Tomcat (

Assuming your Java is correct, and you use the correct things in the correct places, your application should work right out of the box; all without mutating from someone else's example application.

Chicken or Egg?

One of the toughest parts of developing Struts applications is what to do first. There's a three-way coordination between the user-presentation JSPs, the server configuration files, and the Java classes used to do the server-side work. When deep in the development cycle, it becomes a matter of habit to create the classes first and configurations next before making the JSPs, or to create the classes and JSPs together before adding the configuration, or even to try to develop all three together, adding configuration items as classes and JSPs are introduced. For our purposes, we'll discuss first a system that has been theoretically configured before we got here, that we will use to discover the relationships between the simple components.

We'll start with the web server, which must be running before requests can be made, and then look at the classes, which will be required when the web server starts working, and finally the JSPs that will be requested by the users.

After we have our discussion about the component parts, we'll discuss a couple of sample set-ups from the perspective of a brand new IDE project in both NetBeans and Eclipse.

Retrieved from ""

This page has been accessed 17055 times. This page was last modified 19:52, 13 Jan 2006.

Main Page
Community portal
Current events
Recent changes
Random page
Edit this page
Editing help
This page
Discuss this page
Post a comment
Printable version
Page history
What links here
Related changes
My pages
Create an account or log in
Special pages
New pages
Image list
Bug reports