FormAction now allows usage of a validator when the formObjectClass is null.

This commit is contained in:
Erwin Vervaet
2007-04-03 07:57:51 +00:00
parent be58f875c5
commit 4b433ce0b4
2 changed files with 21 additions and 0 deletions

View File

@@ -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

View File

@@ -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) {