Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

The Bootstrap tutorial walks through installing the framework and creating a simple application.

Note

While the framework is simple to use, creating non-trivial applications assumes a working knowledge of many JEE technologies, including

...

:

  • Java

...

  • Filters, JSP, and Tag Libraries
  • JavaBeans
  • HTML and HTTP
  • Web Containers (

...

  • such as Tomcat)
  • XML

...

This site is set up with many features. Here are links to help you around:

...

The distribution contains the following directory layout:

No Format

docs/
lib/
src/
src/java/template/
webwork-(VERSION).jar
webwork-example.war
webwork-migration.jar

The docs directory contains the current Javadocs, the document you are reading, as well as JUnit reports for the build. The lib directory contains the required as well as the optional dependencies for Webwork:

No Format

lib/
      core/
      migration/
      optional/

Note that none of the optional packages are required to use Webwork. If you wish to use certain features such as JasperReports and FreeMarker results, you must include the optional packages.

Webwork also comes packaged with all the source files and the templates for the JSP tags.

...

The following illustrates how your web application should be set up. Copy the webwork-(VERSION).jar, all the *.jar files in /lib/core and any necessary optional *.jar files in /lib/optional to your webapp/lib directory. If you need to customize your own templates (how HTML is rendered from webwork UI tags), copy the /src/java/template directory into your webapp/ directory. Your webapp should look similar to this:

Code Block

/mywebapp/
/mywebapp/template/
/mywebapp/META-INF/
/mywebapp/WEB-INF/
/mywebapp/WEB-INF/classes/
/mywebapp/WEB-INF/lib/
/mywebapp/WEB-INF/lib/CORE&OPTIONAL *.jar
/mywebapp/WEB-INF/web.xml

Onward to Configuration or the Webwork Tutorial

...

In order to run webwork applications and demos, you need to have a servlet/jsp engine. If you don't, we suggest you learn about Apache Tomcat, which is a free Servlet container from the Apache Jakarta Project, or Resin, from Caucho Technology, which is free for non-comercial use. Once you a Servlet container setup, you can install the webwork example applications (*.war) and any other demos by placing the .war file inside the containers webapp directory. Example of location with tomcat:

Code Block

<TOMCAT_HOME>/webapps/webwork-example.war

After the war file is in the correct location, start your web container and access your application through a web browser with the following url.

...

(lightbulb) For more about supporting technologies, see the Key Technologies Primer.

In the Ready, Set, Go! lesson, we download the framework and get started on an application of our own.

Download the Distribution

A distribution can be downloaded from the Apache Struts website. The full distribution contains the struts2-core.jar file,related dependencies, example applications, a copy of the documentation in HTML format, and the complete source code.

Tip

To compile it yourself, refer to Building the Framework from Source.

Our First Application

To get started with a new application, we can use the blank template, run the Maven archetype, or set up a web infrastructure from scratch.

Using the Blank Application

The blank web application in the distribution's apps directory is meant as a template. We can make a copy of the "blank.war", deploy it to our container, and use the exploded copy as the basis for our application. There is even a simple batch file in the source code directory that we can use to recompile the application in place.

Run the Maven Archetype

For those of us using Maven as a build system, we can use the Maven Archetype to create a new application.

For directions on using the Struts 2 archetypes see the Struts 2 Maven Archetypes page.

Setting up from scratch

If for some reason the blank template or archetype doesn't work out, it's not so hard to setup a Struts 2 application from scratch. For details, see Simple Setup.

Next

Onward to Hello World

Prev

Return to Bootstrap