- All Implemented Interfaces:
- net.sourceforge.stripes.config.ConfigurableComponent, net.sourceforge.stripes.tag.PopulationStrategy
public class SelectivePopulationStrategy
extends Object
implements net.sourceforge.stripes.tag.PopulationStrategy
When you want to select the populationstrategy per actionbean, this the way to go:
Drop the SelectivePopulationStrategy into Stripes' extensions package and annotate your action bean.
Assuming you want to use BeanFirstPopulationStrategy on your ExampleActionBean, it would look as follows.
- Author:
- Meine Toonen meinetoonen@b3partners.nl
Possible populationstrategies:
The DefaultPopulationStrategy searches in the following order for the first non-null value(s) when populating a given input tag:
The HttpServletRequest parameter map for values matching the name of the input tag
The ActionBean for a property or nested property matching the name of the input tag
The value specified by the tag itself (varies by tag; usually as a value attribute, or as the body of the tag)
The reasoning behind this is as follows:
What the user entered should take precedence when re-displaying input to that same user
Values in the ActionBean usually represent domain values, and are common sources or pre-population
Values on the page are usually defaults specified for when no other applicable value is present
Stripes also includes a second population strategy called BeanFirstPopulationStrategy. The semantics of this population strategy are quite different - it's search strategy is:
If the field in question has errors, revert to the DefaultPopulationStrategy
Otherwise if an ActionBean is present and has a matching property, use it's value even if it is null
Otherwise look for a non-null value specified on the page
And lastly, look for a non-null value in the HttpServletRequest
From: http://www.stripesframework.org/display/stripes/Overriding+PopulationStrategy+per+ActionBean