Results 1 to 5 of 5

Thread: More than one formatter in Spring web flow 2.0

  1. #1

    Default More than one formatter in Spring web flow 2.0

    Hi All,
    I implemented one formatter using annonation in my code. As the requirements gets increased , i have to add one more formatter. How to add another formatter in config file ? Constructor of DefaultConversionService accepts only one formatter class. Please provide the details to implement two or more formatter.

    Here are the config details:

    <flow:flow-builder-services id="flowBuilderServices" conversion-service="defaultConversionService" view-factory-creator="viewFactoryCreator"/>

    <mvc:annotation-driven />
    <bean id="myFormattingFactory" class="com.att.clouduser.converter.StringFormattin gFactory" />

    <bean id="controllerHandlerAdapter" class="org.springframework.web.servlet.mvc.SimpleC ontrollerHandlerAdapter"/>


    <bean id="defaultConversionService" class="org.springframework.binding.convert.service .DefaultConversionService">
    <constructor-arg ref="myFormattingFactory"/>
    </bean>

  2. #2
    Join Date
    Aug 2006
    Location
    Arequipa-Peru / South America
    Posts
    2,796

    Default

    Hello

    I had a similar problem about this, Did you read the SWF documentation? I recall have read something like this

    Here in the forum has some similiar (see 3rd post)
    ConversionService + NumberFormatter

    HTH
    - Manuel Jordan

    Kill Your Pride, Share Your Knowledge With All
    The Fear Of The LORD Is The Beginning Of Knowledge, But Fools Despise Wisdom And Discipline. Proverbs 1:7

    Blog


    Technical Reviewer of Apress

    • Pro SpringSource dm Server
    • Spring Enterprise Recipes: A Problem-Solution Approach
    • Spring Recipes: A Problem-Solution Approach, 2nd Edition
    • Pro Spring Integration
    • Pro Spring Batch
    • Pro Spring 3
    • Pro Spring MVC: With Web Flow
    • Pro Spring Security

  3. #3

    Default More than one formatter in Spring web flow 2.0

    Hi,
    HOw did you solve the problem? When i add more than one formatter, the last only exists. Other formatters are overrided (i.e) only one formatter can be able to register it.

    protected void installFormatters(FormatterRegistry registry) {
    super.installFormatters(registry);
    registry.addFormatterForFieldAnnotation(new StringFormatterFactory());
    registry.addFormatterForFieldAnnotation(new NoteFormatterFactory());

    }

    In this code when i call the formatter it always go to the second one NOteFormatter. I want both to be called. Please help me how to do that?

  4. #4
    Join Date
    Aug 2006
    Location
    Arequipa-Peru / South America
    Posts
    2,796

    Default

    Hello

    I just have this

    Code:
    public class ApplicationFormatterService extends FormattingConversionServiceFactoryBean{
    
    ....
    
    @Override
    protected void installFormatters(FormatterRegistry registry) {
    	super.installFormatters(registry);
    	registry.addFormatterForFieldType(Local.class, this.localFormatter);
    	registry.addFormatterForFieldType(Curso.class, this.cursoFormatter);
    	registry.addFormatterForFieldType(Turno.class, this.turnoFormatter);
    	registry.addFormatterForFieldType(TipoTurno.class, this.tipoTurnoFormatter);
    }
    I am not using addFormatterForFieldAnnotation

    In this code when i call the formatter it always go to the second one NOteFormatter. I want both to be called. Please help me how to do that?
    How you got such conclusion?
    - Manuel Jordan

    Kill Your Pride, Share Your Knowledge With All
    The Fear Of The LORD Is The Beginning Of Knowledge, But Fools Despise Wisdom And Discipline. Proverbs 1:7

    Blog


    Technical Reviewer of Apress

    • Pro SpringSource dm Server
    • Spring Enterprise Recipes: A Problem-Solution Approach
    • Spring Recipes: A Problem-Solution Approach, 2nd Edition
    • Pro Spring Integration
    • Pro Spring Batch
    • Pro Spring 3
    • Pro Spring MVC: With Web Flow
    • Pro Spring Security

  5. #5

    Default More than one formatter in Spring web flow 2.0

    The first formatter is not called. It's always calling the second formatter.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •