diff --git a/spring-webflow/changelog.txt b/spring-webflow/changelog.txt index 74dd5f17..8413f01b 100644 --- a/spring-webflow/changelog.txt +++ b/spring-webflow/changelog.txt @@ -17,6 +17,7 @@ Package org.springframework.binding Package org.springframework.webflow.action * FormAction methods doBind() and createBinder() now declare "throws Exception". * FormAction now consistently uses the getters to get property values (SWF-251). +* FormAction now allows usage of a validator when the formObjectClass is null. * ResultObjectBasedEventFactory now uses java.lang.Enum.name() to get the name of a Java 5 enum (SWF-250). Package org.springframework.webflow.config diff --git a/spring-webflow/src/test/java/org/springframework/webflow/action/FormActionTests.java b/spring-webflow/src/test/java/org/springframework/webflow/action/FormActionTests.java index 638b4142..d12d5e0c 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/action/FormActionTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/action/FormActionTests.java @@ -433,6 +433,26 @@ public class FormActionTests extends TestCase { assertSame(formObject, action.getFormObject(context)); assertEquals(true, ((TestBeanValidator)action.getValidator()).invoked); } + + public void testFormActionWithValidatorAndNoFormActionClass() throws Exception { + FormAction action = new FormAction() { + protected Object createFormObject(RequestContext context) throws Exception { + return new TestBean(); + } + }; + action.setValidator(new TestBeanValidator()); + action.initAction(); + + MockRequestContext context = new MockRequestContext(); + + Event result = action.setupForm(context); + assertEquals("success", result.getId()); + + context.putRequestParameter("prop", "foo"); + context.getAttributeMap().put("validatorMethod", "validateTestBean"); + result = action.bindAndValidate(context); + } + // helpers private FormAction createFormAction(String formObjectName) {