Announcement Announcement Module
Collapse
No announcement yet.
Spring.AjaxEventDecoration redirect? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring.AjaxEventDecoration redirect?

    With Webflow 2.07 + tiles 2.0.7, when using Spring.AjaxEventDecoration I'm experiencing a redirect instead of the normal rendered fragment (last version that I am to get Spring.AjaxEventDecoration to work is Spring 2.0.4).

    Should ViewState.doEnter read:
    if (!context.getExternalContext().isAjaxRequest()
    && shouldRedirect(context)) {
    instead of:
    if (shouldRedirect(context)) {?

    or I am I missing configuration to not redirect on pause for ajax requests?

  • #2
    Could you describe your scenario?

    Comment


    • #3
      tiles.xml:
      <tiles-definitions>
      <definition name="demo.tile" template="/WEB-INF/flows/demo/demo-main.jsp">
      <put-attribute name="ajax.content" value="/WEB-INF/flows/demo/demo-ajax-content.jsp" />
      </definition>
      </tiles-definitions>

      demo-main.jsp:
      <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
      <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
      <%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles" %>
      <html><head>
      <script type="text/javascript" src="<c:url value="/resources/dojo/dojo.js" />"> </script>
      <script type="text/javascript" src="<c:url value="/resources/spring/Spring.js" />"> </script>
      <script type="text/javascript" src="<c:url value="/resources/spring/Spring-Dojo.js" />"> </script>
      </head><body>
      <form:form id="demoForm" commandName="demo" method="POST">
      <tiles:insertAttribute name="ajax.content" />
      <input type="submit" id="ajax1" name="_eventId_ajax1" value="Add 1" />
      <script type="text/javascript">
      Spring.addDecoration(new Spring.AjaxEventDecoration({
      elementId:'ajax1',
      event:'onclick',
      formId:'demoForm'}));
      </script>
      </form:form>
      </body>
      </html>

      demo-ajax-content.jsp:
      <html><head></head><body>
      <div id="a_unique_id_1">
      Ajax Content: <span>${demo.clickCount}</span>
      </div>
      </body></html>

      demo-flow.xml
      <var name="demo" class="org.j2eedemos.webflow.tiles2.DemoModel"/>
      <view-state id="entry-point" view="demo.tile" model="demo">
      <transition on="ajax1" to="entry-point">
      <render fragments="ajax.content"></render>
      <evaluate expression="demo.addClickCount()"/>
      </transition>
      </view-state>

      applicationContext.xml:
      <bean id="urlMapping"
      class="org.springframework.web.servlet.handler.Sim pleUrlHandlerMapping">
      <property name="mappings">
      <props>
      <prop key="/demo-flow">flowController</prop>
      </props>
      </property>
      </bean>
      <bean id="flowController"
      class="org.springframework.webflow.mvc.servlet.Flo wController">
      <property name="flowExecutor" ref="flowExecutor"/>
      </bean>
      <webflow:flow-executor id="flowExecutor" flow-registry="flowRegistry">
      </webflow:flow-executor>
      <webflow:flow-registry id="flowRegistry" flow-builder-services="flowBuilderServices">
      <webflow:flow-location
      path="/WEB-INF/flows/demo/demo-flow.xml" id="demo-flow"/>
      </webflow:flow-registry>
      <webflow:flow-builder-services id="flowBuilderServices"
      view-factory-creator="viewFactoryCreator"/>
      <bean id="viewFactoryCreator" class="org.springframework.webflow.mvc.builder.Mvc ViewFactoryCreator">
      <property name="viewResolvers" ref="tilesViewResolver"/>
      </bean>
      <bean id="tilesViewResolver" class="org.springframework.js.ajax.AjaxUrlBasedVie wResolver">
      <property name="viewClass" value="org.springframework.webflow.mvc.view.FlowAj axTilesView"/>
      </bean>

      Comment


      • #4
        Remove to="entry-point" from the transition. That way you'll remain in the same view without redirecting.

        Comment


        • #5
          That worked, thanks!

          Comment

          Working...
          X