Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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 object is responsible for supplying instances of various ConfigurableComponents to parts of Stripes that need them.

When you fire up Stripes without any additional Configuration, Stripes will use an instance of RuntimeConfiguration that extends the DefaultConfiguration 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.

...

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 Block
xml
languagexml
titleConfiguring 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> 

...

For example, to switch to using your own Configuration, you might make the following change to your web.xml:

Code Block
xml
languagexml
titleUsing 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> 

RuntimeConfiguration Properties

...

Property

Value

Default

Validation.InvokeValidateWhenErrorsExist

When true Stripes will call the validate() method regardless of whether earlier validation phases produced validation errors or not. (Introduced in Stripes 1.2)

false