想用spring web flow和richfaces的table实现服务器端分页,可以生成一个假冒的List修改它的size等方法,可以参考《wicket开发指南》中的做法,但这种做法总觉得不太完美。按更好的做法是实现一个特定richfaces table的datamodel,而spring web flow中对table用了他自己的datamodel,这就需要自定义converter。
http://forum.springframework.org/showthread.php?t=59042
The best example is in the booking-mvc sample application.
Steps...
1. Implement your custom converter, modeling after existing converters in org.springframework.binding.convert.converters (done once per custom converter). For example:
- public class StringToMoney extends StringToObject {
-
- public StringToMoney() {
- super(Money.class);
- }
-
- @Override
- protected Object toObject(String string, Class targetClass) throws Exception {
- return Money.valueOf(string);
- }
-
- @Override
- protected String toString(Object object) throws Exception {
- Money amount = (Money) object;
- return amount.toString();
- }
-
- }
2. Create a custom conversion service implementation that installs your custom converters (done once):
- @Component("conversionService")
- public class ApplicationConversionService extends DefaultConversionService {
-
- @Override
- protected void addDefaultConverters() {
- super.addDefaultConverters();
-
-
- addConverter(new StringToMoney());
-
-
- addConverter("shortDate", new StringToDate());
- }
-
- }
3. Register the conversion service with Web Flow (done once):
- <webflow:flow-builder-services id="flowBuilderServices" service="conversionService">
Now there is a bug in 2.0.3 where the default expression parser used during data binding does not apply your custom conversion service. This is fixed in 2.0.4 nightly, but to workaround it on 2.0.3 you must manually configure the expression parser implementation and configure its conversion service e.g.
- <webflow:flow-builder-services id="flowBuilderServices" service="conversionService" parser="expressionParser">
-
- <bean id="expressionParser" class="org.springframework.webflow.expression.el.WebFlowELExpressionParser">
- <constructor-arg>
- <bean class="org.jboss.el.ExpressionFactoryImpl">
- </bean>
- <property name="conversionService" ref="conversionService">
- </property>
4. Default converters for your custom types should be used automatically anytime you bind to a property of that type. For custom converters to be applied for a specific type you reference the converter when you setup a view-binding:
- <view-state id="enterBookingDetails" model="booking">
- <binder>
- <binding property="checkinDate" converter="shortDate" required="true">
- <binding property="checkoutDate" converter="shortDate" required="true">
- <binding property="beds" required="true">
- <binding property="smoking" required="true">
- <binding property="creditCard" required="true">
- <binding property="creditCardName" required="true">
- <binding property="creditCardExpiryMonth" required="true">
- <binding property="creditCardExpiryYear" required="true">
- <binding property="amenities" required="false">
- </binding>
- <transition on="proceed" to="reviewBooking">
- <transition on="cancel" to="cancel" bind="false">
- </transition>
多选:
http://jira.springframework.org/browse/SWF-720
使用jsf的验证器:
http://jira.springframework.org/browse/SWF-799