added var support in sellitem
removed restriction in form action
This commit is contained in:
@@ -9,11 +9,8 @@
|
||||
org.springframework.webflow.executor.jsf.FlowNavigationHandler
|
||||
</navigation-handler>
|
||||
<variable-resolver>
|
||||
org.springframework.webflow.executor.jsf.FlowExecutionVariableResolver
|
||||
org.springframework.webflow.executor.jsf.DelegatingFlowVariableResolver
|
||||
</variable-resolver>
|
||||
<property-resolver>
|
||||
org.springframework.webflow.executor.jsf.FlowExecutionPropertyResolver
|
||||
</property-resolver>
|
||||
</application>
|
||||
|
||||
<lifecycle>
|
||||
|
||||
@@ -25,6 +25,6 @@ import org.springframework.beans.propertyeditors.CustomDateEditor;
|
||||
public class SellItemPropertyEditorRegistrar implements PropertyEditorRegistrar {
|
||||
|
||||
public void registerCustomEditors(PropertyEditorRegistry registry) {
|
||||
registry.registerCustomEditor(Date.class, new CustomDateEditor(new SimpleDateFormat("MM/dd/yyyy"), true));
|
||||
registry.registerCustomEditor(Date.class, new CustomDateEditor(new SimpleDateFormat("dd/MM/yyyy"), true));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
<!-- Manages setting up, binding input to, and validating a Sale "backing wizard form object" -->
|
||||
<bean id="formAction" class="org.springframework.webflow.action.FormAction">
|
||||
<property name="formObjectClass" value="org.springframework.webflow.samples.sellitem.Sale"/>
|
||||
<property name="formObjectName" value="sale"/>
|
||||
<property name="formObjectScope" value="CONVERSATION"/>
|
||||
<property name="formErrorsScope" value="CONVERSATION"/>
|
||||
<property name="validator">
|
||||
|
||||
@@ -3,15 +3,15 @@
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/webflow
|
||||
http://www.springframework.org/schema/webflow/spring-webflow-1.0.xsd">
|
||||
|
||||
<start-actions>
|
||||
<!-- create the backing form object and initialize a empty errors collection -->
|
||||
<action bean="formAction" method="setupForm"/>
|
||||
</start-actions>
|
||||
|
||||
<var name="sale" class="org.springframework.webflow.samples.sellitem.Sale" scope="conversation"/>
|
||||
|
||||
<start-state idref="enterPriceAndItemCount"/>
|
||||
|
||||
<view-state id="enterPriceAndItemCount" view="priceAndItemCountForm">
|
||||
<view-state id="enterPriceAndItemCount" view="priceAndItemCountForm">
|
||||
<render-actions>
|
||||
<action bean="formAction" method="setupForm"/>
|
||||
</render-actions>
|
||||
<transition on="submit" to="enterCategory">
|
||||
<action bean="formAction" method="bindAndValidate">
|
||||
<attribute name="validatorMethod" value="validatePriceAndItemCount"/>
|
||||
@@ -44,7 +44,6 @@
|
||||
|
||||
<end-state id="finish" view="costOverview">
|
||||
<entry-actions>
|
||||
<!-- force reinstall of property editors so costOverview can render formatted Sale values -->
|
||||
<action bean="formAction" method="setupForm"/>
|
||||
</entry-actions>
|
||||
</end-state>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
<!-- Manages setting up, binding input to, and validating a Sale "backing wizard form object" -->
|
||||
<bean id="formAction" class="org.springframework.webflow.action.FormAction">
|
||||
<property name="formObjectClass" value="org.springframework.webflow.samples.sellitem.Sale"/>
|
||||
<property name="formObjectName" value="sale"/>
|
||||
<property name="validator">
|
||||
<bean class="org.springframework.webflow.samples.sellitem.SaleValidator"/>
|
||||
</property>
|
||||
|
||||
@@ -3,15 +3,15 @@
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/webflow
|
||||
http://www.springframework.org/schema/webflow/spring-webflow-1.0.xsd">
|
||||
|
||||
<start-actions>
|
||||
<!-- create the backing form object and initialize a empty errors collection -->
|
||||
<action bean="formAction" method="setupForm"/>
|
||||
</start-actions>
|
||||
|
||||
<var name="sale" class="org.springframework.webflow.samples.sellitem.Sale"/>
|
||||
|
||||
<start-state idref="enterPriceAndItemCount"/>
|
||||
|
||||
<view-state id="enterPriceAndItemCount" view="priceAndItemCountForm">
|
||||
<view-state id="enterPriceAndItemCount" view="priceAndItemCountForm">
|
||||
<render-actions>
|
||||
<action bean="formAction" method="setupForm"/>
|
||||
</render-actions>
|
||||
<transition on="submit" to="enterCategory">
|
||||
<action bean="formAction" method="bindAndValidate">
|
||||
<attribute name="validatorMethod" value="validatePriceAndItemCount"/>
|
||||
@@ -49,7 +49,6 @@
|
||||
|
||||
<end-state id="finish" view="costOverview">
|
||||
<entry-actions>
|
||||
<!-- force reinstall of property editors so costOverview can render formatted Sale values -->
|
||||
<action bean="formAction" method="setupForm"/>
|
||||
</entry-actions>
|
||||
</end-state>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
<start-state idref="enterShippingDetails"/>
|
||||
|
||||
<view-state id="enterShippingDetails" view="shippingDetailsForm">
|
||||
<view-state id="enterShippingDetails" view="shippingDetailsForm">
|
||||
<transition on="submit" to="finish">
|
||||
<action bean="formAction" method="bind"/>
|
||||
</transition>
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/webflow
|
||||
http://www.springframework.org/schema/webflow/spring-webflow-1.0.xsd">
|
||||
|
||||
<start-actions>
|
||||
<!-- create the backing form object and initialize a empty errors collection -->
|
||||
<action bean="formAction" method="setupForm"/>
|
||||
</start-actions>
|
||||
|
||||
<var name="sale" class="org.springframework.webflow.samples.sellitem.Sale"/>
|
||||
|
||||
<start-state idref="enterPriceAndItemCount"/>
|
||||
|
||||
<view-state id="enterPriceAndItemCount" view="priceAndItemCountForm">
|
||||
<view-state id="enterPriceAndItemCount" view="priceAndItemCountForm">
|
||||
<render-actions>
|
||||
<action bean="formAction" method="setupForm"/>
|
||||
</render-actions>
|
||||
<transition on="submit" to="enterCategory">
|
||||
<action bean="formAction" method="bindAndValidate">
|
||||
<attribute name="validatorMethod" value="validatePriceAndItemCount"/>
|
||||
@@ -46,7 +46,6 @@
|
||||
|
||||
<end-state id="finish" view="costOverview">
|
||||
<entry-actions>
|
||||
<!-- force reinstall of property editors so costOverview can render formatted Sale values -->
|
||||
<action bean="formAction" method="setupForm"/>
|
||||
</entry-actions>
|
||||
</end-state>
|
||||
|
||||
@@ -494,8 +494,7 @@ public class FormAction extends MultiAction implements InitializingBean {
|
||||
|
||||
protected void initAction() {
|
||||
if (getValidator() != null) {
|
||||
Assert.notNull(getFormObjectClass(), "When using a validator, the form object class is required");
|
||||
if (!getValidator().supports(getFormObjectClass())) {
|
||||
if (getFormObjectClass() != null && !getValidator().supports(getFormObjectClass())) {
|
||||
throw new IllegalArgumentException("Validator [" + getValidator()
|
||||
+ "] does not support form object class [" + getFormObjectClass() + "]");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user