removed non jsf std stuff
This commit is contained in:
@@ -1,7 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beansProjectDescription>
|
||||
<configExtensions>
|
||||
<configExtension>xml</configExtension>
|
||||
</configExtensions>
|
||||
<configs>
|
||||
<config>src/main/java/org/springframework/webflow/samples/sellitem/services-config.xml</config>
|
||||
<config>src/main/webapp/WEB-INF/webflow-config.xml</config>
|
||||
</configs>
|
||||
<configSets>
|
||||
<configSet>
|
||||
<name>webapp</name>
|
||||
<allowBeanDefinitionOverriding>true</allowBeanDefinitionOverriding>
|
||||
<incomplete>false</incomplete>
|
||||
<configs>
|
||||
<config>src/main/java/org/springframework/webflow/samples/sellitem/services-config.xml</config>
|
||||
<config>src/main/webapp/WEB-INF/webflow-config.xml</config>
|
||||
</configs>
|
||||
</configSet>
|
||||
</configSets>
|
||||
</beansProjectDescription>
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Copyright 2004-2007 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.webflow.samples.sellitem;
|
||||
|
||||
import org.springframework.validation.Errors;
|
||||
import org.springframework.validation.Validator;
|
||||
|
||||
public class SaleValidator implements Validator {
|
||||
|
||||
public boolean supports(Class clazz) {
|
||||
return Sale.class.equals(clazz);
|
||||
}
|
||||
|
||||
public void validate(Object obj, Errors errors) {
|
||||
Sale sale = (Sale)obj;
|
||||
validatePriceAndItemCount(sale, errors);
|
||||
}
|
||||
|
||||
public void validatePriceAndItemCount(Sale sale, Errors errors) {
|
||||
// the next two items are normally more appropriately handled by JSF
|
||||
// field validation. We'll leave them here for safety
|
||||
if (sale.getItemCount() <= 0) {
|
||||
errors.rejectValue("itemCount", "tooLittle", "Item count must be greater than 0");
|
||||
}
|
||||
if (sale.getPrice() <= 0.0) {
|
||||
errors.rejectValue("price", "tooLittle", "Price must be greater than 0.0");
|
||||
}
|
||||
|
||||
// perhaps an artificial example, but we want to show that in the JSF integration
|
||||
// validators are best used for validation of field relationships.
|
||||
// Individual fields are better validated with simple JSF field validation
|
||||
if (sale.getItemCount() * sale.getPrice() > 1000000)
|
||||
errors.reject("saleTooLarge", "total dollar value for sale above allowed limit");
|
||||
}
|
||||
}
|
||||
@@ -7,11 +7,7 @@
|
||||
<start-state idref="enterPriceAndItemCount" />
|
||||
|
||||
<view-state id="enterPriceAndItemCount" view="/priceAndItemCountForm.jsp">
|
||||
<transition on="submit" to="enterCategory">
|
||||
<action bean="sellItemFormAction" method="validate">
|
||||
<attribute name="validatorMethod" value="validatePriceAndItemCount" />
|
||||
</action>
|
||||
</transition>
|
||||
<transition on="submit" to="enterCategory"/>
|
||||
</view-state>
|
||||
|
||||
<view-state id="enterCategory" view="/categoryForm.jsp">
|
||||
@@ -35,6 +31,6 @@
|
||||
<transition on="success" to="showCostOverview" />
|
||||
</action-state>
|
||||
|
||||
<end-state id="showCostOverview" view="/costOverview" />
|
||||
<end-state id="showCostOverview" view="/costOverview.sjp" />
|
||||
|
||||
</flow>
|
||||
@@ -19,16 +19,6 @@
|
||||
<!-- A "Sale" managed bean created by JSF for each 'sellitem' flow execution -->
|
||||
<bean name="sale" class="org.springframework.webflow.samples.sellitem.Sale" scope="prototype" />
|
||||
|
||||
<!-- A form action for applying custom validation to the Sale managed bean -->
|
||||
<bean id="sellItemFormAction" class="org.springframework.webflow.action.FormAction">
|
||||
<property name="formObjectName" value="sale" />
|
||||
<property name="formObjectClass" value="org.springframework.webflow.samples.sellitem.Sale" />
|
||||
<property name="formObjectScope" value="FLOW" />
|
||||
<property name="validator">
|
||||
<bean class="org.springframework.webflow.samples.sellitem.SaleValidator" />
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!--
|
||||
Spring configured flow navigation handler delegate, allowing for custom configuration
|
||||
using standard dependency injection techniques.
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
<tr>
|
||||
<td colspan="2" class="buttonBar">
|
||||
<input type="hidden" name="_flowExecutionKey" value="${flowExecutionKey}"/>
|
||||
<h:commandButton type="submit" value="Next" action="submit" immediate="false" /></td>
|
||||
<h:commandButton type="submit" value="Next" action="submit" immediate="false" />
|
||||
</td>
|
||||
</tr>
|
||||
</h:form>
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
<tr>
|
||||
<td colspan="2" class="buttonBar">
|
||||
<input type="hidden" name="_flowExecutionKey" value="${flowExecutionKey}"/>
|
||||
<h:commandButton type="submit" value="Next" action="submit" immediate="false" /></td>
|
||||
<h:commandButton type="submit" value="Next" action="submit" immediate="false" />
|
||||
</td>
|
||||
</tr>
|
||||
</h:form>
|
||||
|
||||
Reference in New Issue
Block a user