FormAction now allows usage of a validator when the formObjectClass is null.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user