Announcement Announcement Module
Collapse
No announcement yet.
Basic <render> and <transition> qustions Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Basic <render> and <transition> qustions

    Hi,
    I am learning webflow and set up very simple project.
    This is the flow:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <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"
    	start-state="start">
    
    	<view-state id="start" view="main">
    		<transition on="go">
    			<render fragments="b" />
    		</transition>
    
    		<transition on="goo" to="next">
    			<render fragments="b" />
    			<!--<evaluate expression="flashScope.text='adsf'"></evaluate> -->
    		</transition>
    	</view-state>
    
    	<view-state id="next" view="next">
    
    	</view-state>
    
    </flow>
    I use Tiles for views and both views got two fragments - a & b that just dump the current date & time.

    What was counter-intuitive for me:
    * partial rendering via <render fragment../> does not work unless I have the Spring.AjaxEventDecoration in combination - is this really how it was intended to be or am I doing something wrong? Without the ajax decoration, both fragments are rendered, regardless what I specify in <render ...>. Yes, I understand the whole page is sent, but I expected that the fragments not mentioned in the render tag would be used cached. Effectively from what I see the <render> tag makes no sense without the Ajax decoration - is this so?

    * putting <evaluate> tag in the <transition> prevents it from transiting - this is pretty unexpected and I don't remember reading this in the manual - did I miss something?

    Cheers,
    Georgi

  • #2
    Yes, you need to have the Spring.AjaxEventDecoration in place for this to work.

    Partial rendering ONLY works through an AJAX request, which must be initiated through Javascript. The Spring.AjaxEventDecoration adds the Javascript to do this. Without this, there is no partial rendering and you get a full page refresh. This is expected behavior to accomodate browsers running with Javascript turned off.

    The evaluate tag will cancel the transition which contains it if it evaluates to null (I think?) or false. This side effect is unusual, but it is documented in the Executing View Transitions section of the reference docs.

    However, from the looks of things it looks like you're trying to set something into scope. I tend to use the set action rather than the evaluate action do to this, or for invoking any setter on any object:

    Code:
    <set name="flashScope.text" value="'adsf'"/>
    Set actions have no side effects, I believe.

    Comment

    Working...
    X