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

  • Webflow variable scope

    Hi,

    Below is my flow xml.
    Code:
    <flow xmlns="http://www.springframework.org/schema/webflow" 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-2.0.xsd">
    	<var name="quote" class="com.ins.entity.program1.Quote"/>
    	<view-state id="program1Start" view="Program1/Page1" model="quote">
    		<transition on="next" to="page2" />
    		<transition on="cancel" to="exitFLow"/>
    	</view-state>
    	<view-state id="page2" view="Program1/Page2" model="quote">
    		<transition on="next" to="page3" />
    		<transition on="back" to="program1Start"/>
    	</view-state>
    	<view-state id="page3" view="Program1/Page3" model="quote">
    		<transition on="next" to="search" />
    		<transition on="back" to="page2"/>
    	</view-state>
    	<end-state id="search" view="redirect:/common/Search.html"/>
    	<end-state id="exitFLow" view="redirect:/common/ProgramSelection.html"/>
    </flow>
    I need a object of "Quote" class which should be used only within this flow. So, i have created a variable with "quote" as you can see in above example which is used through out my flow.
    But the problem is that this object scope is not within the flow even if i logout and call session.invalide() and login again this object has its old values.

    How i can make my variable scope to flow?

    Please let me know if its not clear.
    Please help. Thanks

  • #2
    That should just work.. If it is still there make really sure that you are invalidating the session also if you are using another storage for your flow state (not the session) it has little use in invalidating the session. But judging from your observations I doubt that your session gets (properly) invalidated.

    Comment


    • #3
      it properly gets invalidated because other objects that i used to store in session, like login object its get removed.
      But this web flow variable doesn't.

      Comment


      • #4
        It should be working. But another way to do it is by executing and storing your variable in the flow scope. In brief, there are four scopes in webflow: conversation, flash, flow and view. One option is to keep your variable in the flow scope as follows:

        HTML Code:
        <on-start>
        	<evaluate expression="myServiceOrFactory.createQuote()" result="flowScope.quote" />
        </on-start>
        That way your quote object should be available along the flow life span.

        Good luck

        Comment


        • #5
          That works !!!

          Thanks a lot !!!

          It works !! Thank you so much !!
          Here i have to create a factory class to create object.
          Is there any way so that i can create object just by referring the class?
          like
          Code:
          <var name="quote" class="com.ins.entity.program1.Quote"/>
          Thanks again !!!

          Comment

          Working...
          X