net.sourceforge.stripes.tag
Class BeanFirstPopulationStrategy

java.lang.Object
  extended by net.sourceforge.stripes.tag.DefaultPopulationStrategy
      extended by net.sourceforge.stripes.tag.BeanFirstPopulationStrategy
All Implemented Interfaces:
ConfigurableComponent, PopulationStrategy

public class BeanFirstPopulationStrategy
extends DefaultPopulationStrategy

An alternative tag population strategy that will normally prefer the value from the ActionBean over values from the request - even when the ActionBean returns null! Only if the ActionBean is not present, or does not define an attribute with the name supplied to the tag will other population sources be examined. When that happens, the strategy will check the value specified on the page next, and finally the value(s) in the request.

If the field represented by the tag is determined to be in error (i.e. the ActionBean is present and has validation errors for the matching field) then the repopulation behaviour will revert to the default behaviour of preferring the request parameters.

Since:
Stripes 1.4
Author:
Tim Fennell

Constructor Summary
BeanFirstPopulationStrategy()
           
 
Method Summary
 Object getValue(InputTagSupport tag)
          Implementation of the interface method that will follow the search described in the class level JavaDoc and attempt to find a value for this tag.
 
Methods inherited from class net.sourceforge.stripes.tag.DefaultPopulationStrategy
getConfiguration, getValueFromActionBean, getValueFromTag, getValuesFromRequest, init, isFormInError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanFirstPopulationStrategy

public BeanFirstPopulationStrategy()
Method Detail

getValue

public Object getValue(InputTagSupport tag)
                throws StripesJspException
Implementation of the interface method that will follow the search described in the class level JavaDoc and attempt to find a value for this tag.

Specified by:
getValue in interface PopulationStrategy
Overrides:
getValue in class DefaultPopulationStrategy
Parameters:
tag - the form input tag whose value to populate
Returns:
Object will be one of null, a single Object or an Array of Objects depending upon what was submitted in the prior request, and what is declared on the ActionBean
Throws:
StripesJspException


? Copyright 2005-2006, Stripes Development Team.