
Stripes requires minimal configuration to get up and running, and zero configuration per ActionBean or page. That said, it is possible to change some of Stripes' behaviour using configuration. The way this is handled is that a [Configuration|http://stripes.sourceforge.net/docs/current/javadoc/index.html?net/sourceforge/stripes/config/Configuration.html] object is responsible for supplying instances of various [ConfigurableComponents|http://stripes.sourceforge.net/docs/current/javadoc/index.html?net/sourceforge/stripes/config/ConfigurableComponent.html] to parts of Stripes that need them.
When you fire up Stripes without any additional Configuration, Stripes will use an instance of [RuntimeConfiguration|http://stripes.sourceforge.net/docs/current/javadoc/index.html?net/sourceforge/stripes/config/RuntimeConfiguration.html] that extends the [DefaultConfiguration|http://stripes.sourceforge.net/docs/current/javadoc/net/sourceforge/stripes/config/DefaultConfiguration.html] and is capable of overriding the defaults if configured to do so. The following sections will walk through how to configure the components of Stripes that are used by default, and how to override those components with custom components developed for your project. Note that while you may supply alternative implementations for any ConfigurableComponent, not all the default implementations have configuration properties of their own.
{anchor:Initial Configuration}
h2. Initial Configuration
To get up and running all you need to do is configure the Stripes dispatcher servlet, and the Stripes filter in your web.xml. The following shows an example configuration.
{code:xml|title=Configuring Stripes in your web.xml}
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<description>A description of your web application</description>
<display-name>Your web application's name</display-name>
<filter>
<display-name>Stripes Filter</display-name>
<filter-name>StripesFilter</filter-name>
<filter-class>net.sourceforge.stripes.controller.StripesFilter</filter-class>
<init-param>
<param-name>ActionResolver.Packages</param-name>
<param-value>my.action.bean.pkg</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>StripesFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
<filter-mapping>
<filter-name>StripesFilter</filter-name>
<servlet-name>StripesDispatcher</servlet-name>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
<servlet>
<servlet-name>StripesDispatcher</servlet-name>
<servlet-class>net.sourceforge.stripes.controller.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>StripesDispatcher</servlet-name>
<url-pattern>*.action</url-pattern>
</servlet-mapping>
</web-app>
{code}
Note that the last piece, configuring a servlet mapping for \*.action can be replaced or augmented with any pattern you choose.
{tip:title=The ActionResolver.Packages parameter}
The {{ActionResolver.Packages}} Stripes Filter init-param is *required*. Indicate one or more package _roots_ (without {{.*}} — subpackages are automatically included) where your ActionBean classes are. Stripes auto-discovers your ActionBeans at runtime by scanning those packages and their subpackages. This saves you from having to enumerate all your ActionBeans somewhere and maintaining that when you add, change, or remove ActionBeans.
{tip}
h2. Supplying Additional Configuration
In order to keep things simple, there are no external configuration files with Stripes. All of the ConfigurableComponents in Stripes use the same mechanism to find configuration properties. When a property is looked for, it is first looked for as an initialization parameter to the Stripes Filter. If a value is not found there, the property is looked for as an initialization parameter for the Web Application within which Stripes is running. If a value cannot be found there, it is looked for in the Java System Properties.
It is expected that in 99% of the cases all configuration will be done using initialization parameters for the Stripes Filter, since in most cases you will want to have a single Stripes application per web application. The other two levels become more useful if you have multiple Stripes applications and want to share configuration information across them, or want to be able to supply different values at the command line for different environments.
h2. Configuration Configuration
As mentioned above, Stripes uses a [Configuration|http://stripes.sourceforge.net/docs/current/javadoc/net/sourceforge/stripes/config/Configuration.html] object to drive it's runtime configuration. Two implemenations ship with Stripes. The [DefaultConfiguration|http://stripes.sourceforge.net/docs/current/javadoc/net/sourceforge/stripes/config/DefaultConfiguration.html] does not take any parameters itself, but initializes the default implementation for each component, and the components themselves may take parameters. The [RuntimeConfiguration|http://stripes.sourceforge.net/docs/current/javadoc/net/sourceforge/stripes/config/RuntimeConfiguration.html] uses properties to determine at runtime which component implementations to instantiate. Despite the names, unless you configure it otherwise, Stripes will use a RuntimeConfiguration (DefaultConfiguration is named so because it provides the default configuration information, not because it _is_ the default).
To specify a custom Configuration implementation use:
|| Property || Value || Default ||
| Configuration.Class | The fully qualified name of a class that implements Configuration | net.sourceforge.stripes.config.RuntimeConfiguration |
For example, to switch to using your own Configuration, you might make the following change to your web.xml:
{code:xml|title=Using a different configuration}
<filter>
<display-name>Stripes Filter</display-name>
<filter-name>StripesFilter</filter-name>
<filter-class>net.sourceforge.stripes.controller.StripesFilter</filter-class>
<init-param>
<param-name>Configuration.Class</param-name>
<param-value>com.myco.CustomConfiguration</param-value>
</init-param>
</filter>
{code}
h2. RuntimeConfiguration Properties
The RuntimeConfiguration supports properties for specifying the implementation of each configured component. For more information on what each component is and what it does, click on the links for each of the interfaces. The supported properties are:
|| Property || Value || Default ||
| ActionResolver.Class | The FQN of a class that implements [ActionResolver|http://stripes.sourceforge.net/docs/current/javadoc/net/sourceforge/stripes/controller/ActionResolver.html] | [net.sourceforge.stripes.controller.NameBasedActionResolver|http://stripes.sourceforge.net/docs/current/javadoc/net/sourceforge/stripes/controller/NameBasedActionResolver.html] |
| ActionBeanPropertyBinder.Class | The FQN of a class that implements [ActionBeanPropertyBinder|http://stripes.sourceforge.net/docs/current/javadoc/net/sourceforge/stripes/controller/ActionBeanPropertyBinder.html] | [net.sourceforge.stripes.controller.DefaultActionBeanPropertyBinder|http://stripes.sourceforge.net/docs/current/javadoc/net/sourceforge/stripes/controller/DefaultActionBeanPropertyBinder.html] |
| ActionBeanContextFactory.Class | The FQN of a class that implements [ActionBeanContextFactory|http://stripes.sourceforge.net/docs/current/javadoc/net/sourceforge/stripes/controller/ActionBeanContextFactory.html] | [net.sourceforge.stripes.controller.DefaultActionBeanContextFactory|http://stripes.sourceforge.net/docs/current/javadoc/net/sourceforge/stripes/controller/DefaultActionBeanContextFactory.html] |
| CoreInterceptor.Classes | Interceptors that are loaded by Stripes, regardless to Interceptor.Class param. Those are loaded before Interceptors' one, if any | [net.sourceforge.stripes.controller.BeforeAfterMethodInterceptor|http://stripes.sourceforge.net/docs/current/javadoc/net/sourceforge/stripes/controller/BeforeAfterMethodInterceptor.html], [net.sourceforge.stripes.controller.HttpCacheInterceptor|http://stripes.sourceforge.net/docs/current/javadoc/net/sourceforge/stripes/controller/HttpCacheInterceptor.html]
| ExceptionHandler.Class | The FQN of a class that implements [ExceptionHandler|http://stripes.sourceforge.net/docs/current/javadoc/net/sourceforge/stripes/exception/ExceptionHandler.html] | [net.sourceforge.stripes.exception.DefaultExceptionHandler|http://stripes.sourceforge.net/docs/current/javadoc/net/sourceforge/stripes/exception/DefaultExceptionHandler.html] |
| Extension.Packages | A list of packages that will be searched for Stripes extensions. Examples of extensions include interceptors, formatters, type converters, exception handlers, object post-processors (release 1.6. and later) and custom implementations of ActionResolver, ActionBeanContext, ActionBeanContextFactory, FormatterFactory, LocalePicker, LocalizationBundleFactory, MultipartWrapperFactory, PopulationStrategy, TagErrorRendererFactory, TypeConverterFactory and ObjectFactory (release 1.6 and later). Most applications can simply set the Extension.Packages, ActionResolver.Packages and Stripes.EncryptionKey parameters and be done. | No default value. If this property is not set then extension autodiscovery will be disabled. |
| FormatterFactory.Class | The FQN of a class that implements [FormatterFactory|http://stripes.sourceforge.net/docs/current/javadoc/net/sourceforge/stripes/format/FormatterFactory.html] | [net.sourceforge.stripes.format.DefaultFormatterFactory|http://stripes.sourceforge.net/docs/current/javadoc/net/sourceforge/stripes/format/DefaultFormatterFactory.html] |
| Interceptor.Classes | The comma-separated list of fully qualified class names of [Interceptor|http://stripes.sourceforge.net/docs/current/javadoc/net/sourceforge/stripes/controller/Interceptor.html] classes to use. The list may contain additional whitespace. Entries higher up the list will be invoked before entries lower down. | No default values. See CoreInterceptor for others Interceptors loaded by Stripes. |
| LocalePicker.Class | The FQN of a class that implements [LocalePicker|http://stripes.sourceforge.net/docs/current/javadoc/net/sourceforge/stripes/localization/LocalePicker.html] | [net.sourceforge.stripes.localization.DefaultLocalePicker|http://stripes.sourceforge.net/docs/current/javadoc/net/sourceforge/stripes/localization/DefaultLocalePicker.html] |
| LocalizationBundleFactory.Class | The FQN of a class that implements [LocalizationBundleFactory|http://stripes.sourceforge.net/docs/current/javadoc/net/sourceforge/stripes/localization/LocalizationBundleFactory.html] | [net.sourceforge.stripes.localization.DefaultLocalizationBundleFactory|http://stripes.sourceforge.net/docs/current/javadoc/net/sourceforge/stripes/localization/DefaultLocalizationBundleFactory.html] |
| MultipartWrapperFactory.Class | The FQN of a class that implements [MultipartWrapperFactory|http://stripes.sourceforge.net/docs/current/javadoc/net/sourceforge/stripes/controller/multipart/MultipartWrapperFactory.html] | [net.sourceforge.stripes.controller.multipart.DefaultMultipartWrapperFactory|http://stripes.sourceforge.net/docs/current/javadoc/net/sourceforge/stripes/controller/multipart/DefaultMultipartWrapperFactory.html] |
| PopulationStrategy.Class | The FQN of a class that implements [PopulationStrategy|http://stripes.sourceforge.net/docs/current/javadoc/net/sourceforge/stripes/tag/PopulationStrategy.html] | [net.sourceforge.stripes.tag.DefaultPopulationStrategy|http://stripes.sourceforge.net/docs/current/javadoc/net/sourceforge/stripes/tag/DefaultPopulationStrategy.html] |
| TagErrorRendererFactory.Class | The FQN of a class that implements [TagErrorRendererFactory|http://stripes.sourceforge.net/docs/current/javadoc/net/sourceforge/stripes/tag/TagErrorRendererFactory.html] | [net.sourceforge.stripes.tag.DefaultTagErrorRendererFactory|http://stripes.sourceforge.net/docs/current/javadoc/net/sourceforge/stripes/tag/TagErrorRendererFactory.html] |
| TypeConverterFactory.Class | The FQN of a class that implements [TypeConverterFactory|http://stripes.sourceforge.net/docs/current/javadoc/net/sourceforge/stripes/validation/TypeConverterFactory.html] | [net.sourceforge.stripes.validation.DefaultTypeConverterFactory|http://stripes.sourceforge.net/docs/current/javadoc/net/sourceforge/stripes/validation/DefaultTypeConverterFactory.html] |
| Stripes.DebugMode | A boolean flag that turns debug mode off or on. This should only be set to true during development. Currently, debug mode only turns off encryption, allowing a developer to read values that would otherwise be encrypted before being written to the client.