Apache Struts Web Application Framework
FAQs
Kickstart
Newbie
How to Help
Howto Guides
Action Forms
Building Apps
Database
Indexed Properties
SSL
IDE Guides
Eclipse
Netbeans
Quick Links
Welcome
News and Status
Resources
User and Developer Guides
FAQs and HowTos *
Kickstart FAQ

Contributors:

  • Ted Husted
  • Craig R. McClanahan
  • James DeVries
  • James Holmes
Index

Here are answers to the usual getting-started questions. For an in-depth, searchable FAQ, visit our friends at JGuru.

Why do we need Struts?

Java technologies give developers a serious boost when creating and maintaining applications to meet the demands of today's public Web sites and enterprise intranets. Struts combines Java Servlets, Java ServerPages, custom tags, and message resources into a unified framework. The end result is a cooperative, synergistic platform, suitable for development teams, independent developers, and everyone in between.

How does Struts work?

Java Servlets are designed to handle requests made by Web browsers. Java ServerPages are designed to create dynamic Web pages that can turn billboard sites into live applications. Struts uses a special Servlet as a switchboard to route requests from Web browsers to the appropriate ServerPage. This makes Web applications much easier to design, create, and maintain.

Is Struts compatible with other Java technologies?

Yes. Struts is committed to supporting industry standards. Our lead developer is a member of JSR052, Sun's Expert group for developing a standard library of custom JSP tags. A primary design criteria is that Struts must be compatible with Sun's J2EE platform for corporate enterprises. In fact, Struts really acts as an integrator of Java technologies, so that they can be used in the "real world".

Who wrote Struts?

Struts was created by Craig R. McClanahan, and donated to the Apache Software Foundation in May 2000. Craig is the primary developer of both Struts and Tomcat 4, the basis for the official reference implementation for a servlet 2.3 and JSP 1.2 container. With stable releases of Struts and Tomcat 4 in circulation, Craig is now the Specification Lead for JavaServer Faces (JSR-127), and is the Web Layer Architect for the Java2 Enterprise Edition (J2EE) platform as a whole.

There are now many active committers to the Struts project, working cooperatively from around the globe. Other Java developers are invited to contribute to the project. Struts is an Apache Jakarta project, with the common mission to "provide commercial-quality server solutions based on the Java Platform that are developed in an open and cooperative fashion". All told, 17 individual developers and committers contributed to the Struts 1.0 codebase.

Why is it called Struts?

It's a reference to struts in the architectural sense, a reminder of the nearly invisible pieces that hold up buildings, houses, and bridges.

How is Struts licensed?

Struts is copyrighted software available under a "free-to-use-license" by the Apache Software Foundation. The license appears at the head of every source code file. A reference copy of the license is available here.

Can Struts be used in a commercial product?

Yes. The only requirements you must meet are those listed in the Apache Software Foundation license, which is included at the top of each source file and in the file LICENSE in the top-level directory of the distribution.

In addition, contributions of patches, improved code, new features, or even just requests for features are also welcome.

Do I have to credit Struts on my own website?

You need to credit Struts if you redistribute your own framework based on Struts for other people to use. (See the Apache License for details.) But you do not need to credit Struts just because your web application utilizes the framework. It's the same situation as using the Apache HTTPD server or Tomcat. Not required if its just running your web site. Required if you've used the source code to create your own server that you are redistributing to other people.

Where can I get a copy of Struts?

The best place to download Struts is at jakarta.apache.org/struts. The nightly builds are very stable, and recommended as the best place to start today.

How do I install Struts?

To develop applications with Struts, you can usually just add the Struts JAR file to your Java development environment. You can then start using the Struts classes as part of your own application. A blank Struts application (in the webapps directory, open struts-blank.war) is provided, which you can just copy to get a quick-start on your own brainchild.

Since the full source code for Struts is available, we also provide complete instructions for compiling your own Struts JAR from scratch. (This is actually easier than it looks!)

Your Struts application can usually be deployed using a standard WAR file. In most cases, you simply deposit the WAR file on your application server, and it is installed automatically. If not, step-by-step installation instructions for various servlet containers are available.

When do I need "struts.jar" on my classpath?

When you are compiling an application that uses the Struts classes, you must have the "struts.jar" on the classpath your compiler sees -- it does not have to be on your CLASSPATH environment variable.

Why is that an important distinction? Because if you are using a servlet container on your development machine to test your application, the "struts.jar" must not be on your CLASSPATH environment variable when running the container. (This is because each Web application must also have their own copy of the Struts classes, and the container will become confused if it is on the environment path as well.)

There are several general approaches to this issue:

  • Use ANT for building your projects -- it can easily assemble classpaths for the compiler. (This is how Struts itself is built, along with Tomcat and most other Java-based projects).
  • Use an IDE where you can configure the "class path" used for compilation independent of the CLASSPATH environment variable.
  • Use a shell script that temporarily adds struts.jar to the classpath just for compilation, for example
    javac -classpath /path/to/struts.jar:$CLASSPATH $@
Does Struts include its own unit tests?

Struts currently has two testing environments, to reflect the fact that some things can be tested statically, and some really need to be done in the environment of a running servlet container.

For static unit tests, we use the JUnit framework. The sources for these tests are in the "src/test" hierarchy in the CVS repository, and are executed via the "test.junit" target in the top-level build.xml file. Such tests are focused on the low-level functionality of individual methods, are particularly suitable for the static methods in the org.apache.struts.util utility classes. In the test hierarchy, there are also some "mock object" classes (in the org.apache.struts.mock package) so that you can package up things that look like servlet API and Struts API objects to pass in as arguments to such tests.

Another valuable tool is Struts TestCase which provides a useful harness for Action classes that can be used with JUnit or Cactus.

If the framework doesn't do what I want, can I request that a feature be added?

First, it's important to remember that Struts is an all-volunteer project. We don't charge anyone anything to use Struts. Committers and other developers work on Struts because they need to use it with their own applications. If others can use it too, that's "icing on the cake". If you submit a patch for a feature that a Committer finds useful, then that Committer may choose to volunteer his or her time to apply the patch. If you just submit an idea without a patch, it is much less likely to be added (since first someone else has to volunteer their time to write the patch).

We are grateful for any patches, and we welcome new ideas, but the best way to see that something gets added to the framework is to do as much of the work as you can, rather than rely on the "kindness of strangers". Worst case, you can apply the patch to your copy of Struts and still use the feature in your own application. (Which is what open source is ~really~ all about.)

Where can I get help with Struts?

The Struts package comes complete with a Users Guide to introduce people to the framework and its underlying technologies. Various components also have their own in-depth Developers Guide, to cover more advanced topics. Comprehensive Javadocs are included along with the full source code. For your convenience, these are bundled together as a self-installing application. The struts-documentation.war is the same bundle that is deployed as the Struts Web site.

The Strut's mailing list is also very active, and welcomes posts from new users. Before posting a new question, be sure to consult the MAILING LIST ARCHIVE and the very excellent How To Ask Questions The Smart Way by Eric Raymond. Please do be sure to turn off HTML in your email client before posting.

There are also many third-party tutorials, articles, and books that cover Struts. See our Resources page for current listings and links.

Is commercial support available?

There is no official, commercial support for Struts, though third parties may offer different degrees of support. A list of Struts consultants is available on our Resources page

Are there ISPs that will host my Struts application?

For a listing of some Java and Struts ISPs, visit our Resources page.

What Web sites are already Powered by Struts?

For a listing of some Struts-powered Web sites available to the public, visit our Resources page.

What's the difference between Struts and Turbine? What's the difference between Struts and Expresso?

If you are starting from scratch, packages like Turbine and Expresso can be very helpful since they try to provide all of the basic services that your team is likely to need. Such services include things like data persistence and logging.

If you are not starting from scratch, and need to hook up your web application to an existing infrastructure, then "plain vanilla" Struts can be a better choice. The core Struts framework does not presuppose that you are using a given set of data persistence, presentation, or logging tools. Anything goes =:0)

Compared to other offerings, Struts endeavors to be a minimalist framework. We try leverage existing technologies whenever we can and then provide only the missing pieces you need to combine disparate technologies into a coherent application. This is great when you want to select your own tools to use with Struts. But, if you prefer a more integrated infrastructure, then packages like Turbine or Expresso are perfectly good ways to go.

See also

Why aren't the Struts tags maintained as part of the Jakarta Taglibs project?

Development of both products began about the same time. Leading up to the release of 1.0, it was thought better to continue to develop the taglibs alongside the controller. Now that 1.0 is out, the JavaServer Pages Standard Taglib is in active development. Once work on the JSTL stabilizes, the Struts taglibs will be revisited. Tags which are not linked directly to the framework may be hosted at Jakarta Taglibs instead.

Are the Struts tags XHTML compliant?

If you utilize a <html:html xhtml="true> element on your page, the tags will render in a XHTML compatible manner (since Struts 1.1 beta 2).

Will the Struts tags support other markup languages such as WML

Struts itself is markup neutral. The original Struts taglibs are only one example of how presentation layer components can access the framework. The framework objects are exposed through the standard application, session, and request contexts, where any Java component in the application can make use of them.

Markup extensions that use Struts are available for Velocity and XLST, among others. A new Struts tag library for Java Server Faces is also in development.

For more about using WAP/WML with Struts see the article WAP up your EAserver.

What about the JSTL and JavaServer Faces?

JSTL, the JavaServer Standard Tag Library, is a set of JSP tags that are designed to make it easier to develop Web applications. JavaServer Faces (JSF) is a specification for a new technology that promises to make it easier to write MVC applications, both for the Web and for the desktop.

The inventor of Struts, Craig McClanahan, was a member of the expert group for the JavaServer Standard Tag Library (JSR 052) and is now the specification co-lead for JavaServer Faces (JSR 127). Both technologies are complementary to Struts.

The mainstay of the Struts framework is the controller components, which can be used with any Java presentation technology. As new technologies become available, it is certain that new "glue" components will also appear to help these technologies work as well with Struts.

Struts originally came bundled with a set of custom JSP tags. Today, several extensions are available to help you use Struts with other popular presentation technologies, like XSLT and Velocity. Likewise, extensions for JSTL and JSF are now available as well.

The JSTL reference implementation is available through the Jakarta Taglibs site. A JSTL taglibs for Struts, Struts-El, is distributed as part of the Struts 1.1 release.

Meanwhile, the JSF specification is still under development, although an early-release reference implementation is available through the Java Web Services Developer Pack. An early-release JavaServer Faces taglib for Struts, Struts-Faces, is also in early release and available through the nightly build.

For more about what JavaServer Faces means to the Struts community, see the StrutsMoreAboutJSF wiki page.

Is there a particularly good IDE to use with Struts

Struts should work well with any development environment that you would like to use, as well as with any programmers editor. The members of the Struts development team each use their own tools, which ranges from emacs and Textpad to IDEA by IntelliJ, with NetBeans and Eclipse ranging in between.

At this writing, in the free zone, NetBeans had the edge with JSP editing, but Eclipse has relatively more advanced refactoring features. Eclipse is also a general-purpose IDE and can be used with non-Java projects. In the non-free zone, IDEA by IntelliJ is highly regarded but costs money. (Of course, if *you* cost money, good tools are often a good investment.) Many of the Struts Committers use IDEA, though others do not.

See the Howto Guides for more about configuring IDEs to work with Struts.

Is there a digest for the User list?

Yes. send a blank message to < struts-user-digest-subscribe@jakarta.apache.org>.

If you are subscribed to the digest, you can also post to the list. Just be sure to send your post to the user list rather than trying to reply to the digest.

Is there a Struts newsgroup?

Not a usenet group, but the Struts User list can be accessed with your favorite newsgroup reader from the BaseBeans Engineering site.

Why didn't my posting show up on the user list?

You must be subscribed to the user list or user digest before posting (or use the BaseBeans newsgroup instead).

How do I unsubscribe from the mailing list?

From the email account used to subscribe to the list, send a blank message to < struts-user-unsubscribe@jakarta.apache.org>.

If you are receiving the digest, you must send a blank email to <struts-user-unsubscribe@jakarta.apache.org> instead.


Copyright (c) 2000-2003, Apache Software Foundation