blob: 79196c54b5048a737f4e57cff90d64cd84c86a0c [file] [log] [blame]
<?xml version="1.0"?>
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.
// ======================================================================== 78
<faqs title="Kickstart FAQ">
<part id="general">
<faq id="why">
<question>Why do we need Struts?"</question>
<p>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 standard Java
technologies into a unified framework.
<faq id="how">
<question>How does Struts work?</question>
<p>Java Servlets are designed to handle requests made by Web
browsers. Server pages are designed to create dynamic web
pages that can turn billboard sites into interactive
applications. Struts uses a special
Servlet as a switchboard to route requests from Web
browsers to the appropriate server page.
Along the way, a special Java class, called an Action,
can interact with a data access framework or business
logic classes.
A layered architecture makes enterprise-grade web
applications easier to create and maintain.
(For more detail, see the longer version of
<a href="works.html">"How Does Struts Work?".</a>)
<faq id="compat">
<question>Is Struts compatible with other Java
<p>Yes. The Apache Struts Project is committed to supporting
industry standards.
Struts acts as an integrator of Java technologies so that
they can be used in the &quot;real world&quot;.</p>
<faq id="who">
<question>Who wrote Struts?</question>
<p>There are several
<a href="">active committers</a>
to the Apache Struts project, working cooperatively from
around the globe. Dozens of individual developers and
committers contributed to the Struts 1.x codebase. All
interested developers and wordsmiths are invited to
<a href="">
contribute to the project</a>
<p>The initial Struts codebase (Struts 0.5) was created by
Craig R. McClanahan in May 2000 and donated to The Apache
Software Foundation in May 2000. Craig was the primary
developer of both Struts 1.x and
<a href="">
Tomcat 4</a>
. Tomcat 4 was the basis for the official reference
implementation for a servlet 2.3 and JSP 1.2 container.
<p>After serving as the co-lead of the JSR 127 specification
(JavaServerFaces), Craig created another rendition of
based on JavaServer Faces, called Shale. The new framework
began as an Apache Struts subproject, but later Shale
graduated to a top-level Apache project
in its own right.
<a href="">
Apache Shale</a> is an excellent choice for teams
creating complex applications that utilize JSF
as a foundation technology.
<faq id="first">
<question>Was Struts the first web application framework
for Java?</question>
<p>No, not by a long shot. When Struts 1.0 shipped in June
2001, there were already several other web application
frameworks available, including Barracuda, Expresso,
Maverick, Tapestry, and Turbine, to name a few. Struts did
not enter a "greenfield". Back in the day, there were
lively comparisons between the available frameworks,
just as there are today.
<faq id="popular">
<question>Is Struts the most popular web application
framework for Java?</question>
<p>Yes. By any objective measure, Struts continues to
be the most popular web application framework for
<p>As of 2006, the vast majority of job offerings for Java
developers cite Struts as prerequisite. According to
OnJava magazine between their reader surveys for 2005 and
2004 the popularity of Struts remained steady. Likewise,
the number of Struts articles published in all online
journals also remained constant between 2004 and 2005.
(For a complete list, see the
<a href="">
Struts Central website</a>.)
New and updated books about Struts continue to be
published regularly.</p>
<p>While some people characterize the space of Java web
application framework as being "fragmented", the truth is
<b>more web developers use Struts than all other
alternatives combined.</b>
This observation is as true in 2006 as it was in 2005,
as it was in 2004. It's probably been true since Struts
released its 1.0 version in 2001.
<p>Of course, some developers are finding that JavaServer
Faces can be a faster way to write new applications,
especially modest intranet applications. And
that's great! More than anything else, every Struts
committer wants every developer to get more out of every
work day. (We're developers too!) As these new JSF
applications grow in complexity, we're glad that
<a href="">
Apache Shale</a> is ready to do for
developers what Struts has
been doing for
developers, year after year
after year.
<p>Meanwhile, enterprise web developers who have standardized
on Struts can be assured that new releases of
Struts 1 will continue, even as we break new ground with
Struts 2.</p>
<faq id="where">
<question>Where can I get a copy of Struts
<p>The best place to download Apache Struts products is at
<a href=""></a>
<faq id="install">
<question>How do I install Struts?</question>
<p>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
directory, open
is provided, which you can just copy to get a quick-start
on your own brainchild.
<p>Aside from the Struts jar, the blank
application includes the other Struts
Library JARs and dependencies.
All dependencies are compatible with the Apache License.
<p>Since the full source code for Struts is available, we also
<a href="">
for compiling your own Struts JAR from scratch.
(With Maven, building Struts is easy!)
<p>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
<a href="../userGuide/installation.html#Containers">
various servlet
are available.
<faq id="jar">
<question>When do I need the Struts JARs on my
<p>When you are compiling an application that uses the Struts
classes, you must have the Struts JARs on the classpath your
sees -- it does not
to be on your CLASSPATH environment variable.
<p>Why is that an important distinction? Because if you are
using a servlet container on your development machine to
test your application, the Struts JARs
<strong>must not</strong>
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.)
<p>There are several general approaches to this issue:</p>
<strong>Use Ant or Maven</strong>
for building your projects -- it can easily assemble
classpaths for the compiler.
<strong>Use an IDE</strong>
where you can configure the "class path" used for
compilation independent of the CLASSPATH environment
<strong>Use a shell script</strong>
that temporarily adds struts-action.jar to the
classpath just for compilation, for example
<em>javac -classpath
/path/to/struts-action.jar:$CLASSPATH $@</em>
<faq id="tests">
<question>Does Struts include its own unit
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.</p>
For static unit tests, we use the
<a href="">JUnit framework</a>
The sources for these tests are in the "src/test"
hierarchy in the source 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
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
<a href="">
Struts TestCase</a>
which provides a useful harness for Action classes that
can be used with JUnit or
<a href="">Cactus</a>.