Announcement Announcement Module
Collapse
No announcement yet.
scope problem Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • scope problem

    Hi,

    i have a problem with a object.

    the code:

    one simple object called calendar

    a FrormAction called CalendarFormAction

    an two JSPs one for entering the data and a second to show them.

    the Flow is simple:

    Code:
    <webflow id="calendar" start-state="setupForm">
    
    	<action-state id="setupForm">
    		<action bean="calendar.formAction"/>
    		<transition on="success" to="calendar.view"/>
    	</action-state>
    	
    	<view-state id="calendar.view" view="calendar.view">
    		<transition on="save" to="calendar.save"/>
    	</view-state>
    
    	<action-state id="calendar.save">
    		<action bean="calendar.formAction" method="onSave"/>
    		<transition on="success" to="calendar.show"/>
    	</action-state>
    
    	<end-state id="calendar.show" view="calendar.show"/>		
    
    </webflow>
    the beans config:

    Code:
    <beans>
    	<bean id="eventCalendarFrontController" name="/index.htm" class="org.springframework.web.flow.mvc.FlowController">
    		<property name="cacheSeconds"><value>0</value></property>
    	</bean>
    	<bean id="calendarFrontController" name="/calendar.htm" class="org.springframework.web.flow.mvc.FlowController">
    		<property name="cacheSeconds"><value>0</value></property>
    		<property name="flowExecutionManager">
    			<bean class="org.springframework.web.flow.execution.servlet.HttpServletFlowExecutionManager">
    				<property name="flow" ref="calendar.flow"/>
    			</bean>
    		</property>
    	</bean>
    	<bean id="calendar.flow" class="org.springframework.web.flow.config.FlowFactoryBean">
    		<property name="flowBuilder">
    			<bean class="org.springframework.web.flow.config.XmlFlowBuilder">
    				<property name="resource"><value>/WEB-INF/calendar-flow.xml</value></property>
    			</bean>
    		</property>
    	</bean>
    	
    	<bean id="calendar" class="de.mk.jsek.model.Calendar"/>
    
    	<bean id="calendar.formAction" class="de.mk.jsek.web.flow.CalendarFormAction">
     		<property name="formObjectName"><value>calendar</value></property>
    		<property name="formObjectClass"><value>de.mk.jsek.model.Calendar</value></property>
    		<property name="formObjectScopeAsString"><value>flow</value></property>
     		<property name="calendarDao"><ref bean="calendarDAOHibernate"/></property>
    	</bean>
    	<bean id="calendarDAOHibernate" class="de.mk.jsek.dao.hibernate.CalendarDAOHibernate"/>
    
    	<bean id="conversion.service" class="org.springframework.binding.convert.support.DefaultConversionService" autowire="byType"/>
    	<bean id="formatter.locator" class="org.springframework.binding.format.support.ThreadLocalFormatterLocator" autowire="byType"/>
    	<bean id="thread.cleanupBroadcaster" class="org.springframework.binding.thread.support.DefaultThreadCleanupBroadcaster"/>
    
    	<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    		<property name="prefix"><value>/WEB-INF/jsp/</value></property>
    		<property name="suffix"><value>.jsp</value></property>
    	</bean>
    
    </beans>
    now when i get the Object with this command at the CalendarFormAction Method onSave:



    Code:
    public Event onSave&#40;RequestContext context&#41; throws Exception &#123;
            Calendar calendar = &#40;Calendar&#41;context.getFlowScope&#40;&#41;.get&#40;"calendar"&#41;;
            context.getRequestScope&#40;&#41;.setAttribute&#40;"calendar", calendar&#41;;
            System.out.println&#40;"on saving Calendar "+ context.getRequestScope&#40;&#41;.getAttributeMap&#40;&#41;&#41;;
            System.out.println&#40;"on saving Calendar "+ context.getRequestScope&#40;&#41;.entrySet&#40;&#41;&#41;;
            System.out.println&#40;"on saving Calendar "+ context.getFlowScope&#40;&#41;.getAttributeMap&#40;&#41;&#41;;
            System.out.println&#40;"on saving Calendar "+ context.getFlowScope&#40;&#41;.entrySet&#40;&#41;&#41;;
            
            System.out.println&#40;"Calendar" +calendar.getName&#40;&#41;&#41;;
            return success&#40;&#41;;
        &#125;
    the calendar object are new. no data i entered at the jsp is inside.

    this is my first test of Spring WebFlow so can someone help me to find my mistake?

    thanks

    mfg Gideon

  • #2
    Hi,

    sorry for that post, i have found my mistake, i have forgot to bindAndValidate
    (i was to lazy implementing a validator)

    now it works perfect,

    mfg Gideon

    Comment


    • #3
      The forum works as an excellent "rubber ducky": explaining a problem to someone, even a rubber duck (or yourself) often leads you to finding the solution :-)

      Erwin

      Comment

      Working...
      X